https://github.com/rails/activemodel-serializers-xml
https://github.com/rails/activemodel-serializers-xml
Keywords from Contributors
activerecord rubygems activejob mvc rack rspec multithreading sinatra ruby-gem controllers
Last synced: about 22 hours ago
JSON representation
Repository metadata
- Host: GitHub
- URL: https://github.com/rails/activemodel-serializers-xml
- Owner: rails
- License: mit
- Created: 2015-05-27T23:30:57.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-09-18T12:42:32.000Z (about 1 year ago)
- Last Synced: 2025-11-21T10:04:22.751Z (21 days ago)
- Language: Ruby
- Size: 60.5 KB
- Stars: 56
- Watchers: 13
- Forks: 17
- Open Issues: 2
- Releases: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: MIT-LICENSE
README.md
ActiveModel::Serializers::Xml
This gem provides XML serialization for your Active Model objects and Active Record models.
Installation
Add this line to your application's Gemfile:
gem 'activemodel-serializers-xml'
And then execute:
$ bundle
Or install it yourself as:
$ gem install activemodel-serializers-xml
Usage
ActiveModel::Serializers::Xml
To use the ActiveModel::Serializers::Xml you only need to change from
ActiveModel::Serialization to ActiveModel::Serializers::Xml.
class Person
include ActiveModel::Serializers::Xml
attr_accessor :name
def attributes
{'name' => nil}
end
end
With the to_xml you have an XML representing the model.
person = Person.new
person.to_xml # => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<person>\n <name nil=\"true\"/>\n</person>\n"
person.name = "Bob"
person.to_xml # => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<person>\n <name>Bob</name>\n</person>\n"
From an XML string you define the attributes of the model.
You need to have the attributes= method defined on your class:
class Person
include ActiveModel::Serializers::Xml
attr_accessor :name
def attributes=(hash)
hash.each do |key, value|
send("#{key}=", value)
end
end
def attributes
{'name' => nil}
end
end
Now it is possible to create an instance of person and set the attributes using from_xml.
xml = { name: 'Bob' }.to_xml
person = Person.new
person.from_xml(xml) # => #<Person:0x00000100c773f0 @name="Bob">
person.name # => "Bob"
ActiveRecord::XmlSerializer
This gem also provides serialization to XML for Active Record.
Please see ActiveRecord::Serialization#to_xml for more information.
Contributing to ActiveModel::Serializers::Xml
ActiveModel::Serializers::Xml is work of many contributors. You're encouraged to submit pull requests, propose features and discuss issues.
See CONTRIBUTING
Owner metadata
- Name: Ruby on Rails
- Login: rails
- Email:
- Kind: organization
- Description:
- Website: https://rubyonrails.org/
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/4223?v=4
- Repositories: 116
- Last ynced at: 2023-04-09T03:40:20.529Z
- Profile URL: https://github.com/rails
GitHub Events
Total
- Watch event: 5
Last Year
- Watch event: 3
Committers metadata
Last synced: 8 days ago
Total Commits: 50
Total Committers: 13
Avg Commits per committer: 3.846
Development Distribution Score (DDS): 0.62
Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| Zachary Scott | e@z****o | 19 |
| Rafael Mendonça França | r****a@g****m | 10 |
| Akira Matsuda | r****e@d****p | 4 |
| Vít Ondruch | v****h@r****m | 3 |
| Jean Boussier | j****r@g****m | 3 |
| David Rodríguez | d****z@r****t | 3 |
| Dmitry Sadovsky | d****y@i****u | 2 |
| maclover7 | me@j****e | 1 |
| Vipul A M | v****d@g****m | 1 |
| Thomas Walpole | t****e@g****m | 1 |
| Reid Morrison | r****o@g****m | 1 |
| John Bampton | j****n@g****m | 1 |
| Carlos Antonio da Silva | c****a@g****m | 1 |
Committer domains:
- jonathanmoss.me: 1
- insales.ru: 1
- riseup.net: 1
- redhat.com: 1
- dio.jp: 1
- zzak.io: 1
Issue and Pull Request metadata
Last synced: 3 months ago
Total issues: 9
Total pull requests: 14
Average time to close issues: about 2 months
Average time to close pull requests: 29 days
Total issue authors: 6
Total pull request authors: 11
Average comments per issue: 2.33
Average comments per pull request: 0.79
Merged pull request: 12
Bot issues: 0
Bot pull requests: 0
Past year issues: 1
Past year pull requests: 1
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 1
Past year pull request authors: 1
Past year average comments per issue: 0.0
Past year average comments per pull request: 0.0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- rafaelfranca (3)
- zzak (2)
- tagliala (1)
- klobuczek (1)
- onyxrev (1)
- dbaker24 (1)
Top Pull Request Authors
- voxik (3)
- amatsuda (2)
- wongvarit (2)
- dimailn (1)
- vipulnsward (1)
- twalpole (1)
- maclover7 (1)
- jbampton (1)
- reidmorrison (1)
- deivid-rodriguez (1)
- sanjaymsh (1)
Top Issue Labels
Top Pull Request Labels
Package metadata
- Total packages: 3
-
Total downloads:
- rubygems: 165,215,529 total
- Total docker downloads: 61,065,622
- Total dependent packages: 23 (may contain duplicates)
- Total dependent repositories: 4,706 (may contain duplicates)
- Total versions: 12
- Total maintainers: 12
gem.coop: activemodel-serializers-xml
XML serialization for your Active Model objects and Active Record models - extracted from Rails
- Homepage: http://github.com/rails/activemodel-serializers-xml
- Documentation: http://www.rubydoc.info/gems/activemodel-serializers-xml/
- Licenses: MIT
- Latest release: 1.0.3 (published about 1 year ago)
- Last Synced: 2025-12-09T11:31:50.924Z (3 days ago)
- Versions: 4
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 82,646,125 Total
- Docker Downloads: 30,532,811
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.187%
- Downloads: 0.562%
- Maintainers (12)
rubygems.org: activemodel-serializers-xml
XML serialization for your Active Model objects and Active Record models - extracted from Rails
- Homepage: http://github.com/rails/activemodel-serializers-xml
- Documentation: http://www.rubydoc.info/gems/activemodel-serializers-xml/
- Licenses: MIT
- Latest release: 1.0.3 (published about 1 year ago)
- Last Synced: 2025-12-07T18:02:10.773Z (5 days ago)
- Versions: 4
- Dependent Packages: 23
- Dependent Repositories: 4,706
- Downloads: 82,569,404 Total
- Docker Downloads: 30,532,811
-
Rankings:
- Downloads: 0.356%
- Dependent repos count: 0.46%
- Docker downloads count: 0.801%
- Dependent packages count: 0.958%
- Average: 2.711%
- Forks count: 6.23%
- Stargazers count: 7.461%
- Maintainers (12)
proxy.golang.org: github.com/rails/activemodel-serializers-xml
- Homepage:
- Documentation: https://pkg.go.dev/github.com/rails/activemodel-serializers-xml#section-documentation
- Licenses: mit
- Latest release: v1.0.3 (published about 1 year ago)
- Last Synced: 2025-12-07T18:02:12.248Z (5 days ago)
- Versions: 4
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Forks count: 5.074%
- Stargazers count: 5.764%
- Average: 7.804%
- Dependent packages count: 9.576%
- Dependent repos count: 10.802%
Dependencies
- activerecord >= 5.0.0.a development
- rake ~> 10.0 development
- rexml >= 0 development
- sqlite3 ~> 1.3.6 development
- activemodel >= 5.0.0.a
- activesupport >= 5.0.0.a
- builder ~> 3.1
Score: 25.862702691462104