A summary of data about the Ruby ecosystem.

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

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


GitHub Events

Total
Last Year

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 Email 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:


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

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/rails/activemodel-serializers-xml

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

gem.coop: activemodel-serializers-xml

XML serialization for your Active Model objects and Active Record models - extracted from Rails

rubygems.org: activemodel-serializers-xml

XML serialization for your Active Model objects and Active Record models - extracted from Rails

proxy.golang.org: github.com/rails/activemodel-serializers-xml


Dependencies

activemodel-serializers-xml.gemspec rubygems
  • 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
Gemfile rubygems

Score: 25.862702691462104