Sha256: bdc52574a95e7065f6af28111e1714fa8124be1ceac51fb862b63e3cddb24a90

Contents?: true

Size: 957 Bytes

Versions: 26

Compression:

Stored size: 957 Bytes

Contents

class Publisher
  include ROXML

  xml_accessor :name
  
  def initialize(name = nil)
    @name = name
  end
  
  def ==(other)
    name == other.name
  end
  
  # other important functionality
end

class Novel
  include ROXML

  xml_accessor :isbn, :from => "@ISBN" # attribute with name 'ISBN'
  xml_accessor :title
  xml_accessor :description, :cdata => true  # text node with cdata protection
  xml_accessor :author
  xml_accessor :publisher, :as => Publisher # singular object reference for illustrative purposes.
  
  def ==(other)
    self.class.roxml_attrs.map(&:accessor).all? {|attr| send(attr) == other.send(attr) }
  end
end

class Library
  include ROXML

  xml_accessor :name, :from => "NAME", :cdata => true
  xml_accessor :novels, :as => [Novel] # by default roxml searches for books for in <novel> children, then, if none are present, in ./novels/novel children
  
  def ==(other)
    name == other.name && novels == other.novels
  end
end

Version data entries

26 entries across 26 versions & 6 rubygems

Version Path
roxml-4.2.0 examples/library.rb
roxml-4.1.1 examples/library.rb
roxml-4.1.0 examples/library.rb
roxml-4.0.0 examples/library.rb
Empact-roxml-2.5.1 examples/library.rb
Empact-roxml-2.5.2 examples/library.rb
Empact-roxml-2.5.3 examples/library.rb
doxo-roxml-2.5.3 examples/library.rb
roxml-3.3.1 examples/library.rb
roxml-3.3.0 examples/library.rb
roxml-3.2.2 examples/library.rb
roxml-3.2.1 examples/library.rb
roxml-3.2.0 examples/library.rb
representable-0.0.1.alpha1 examples/library.rb
roxml-3.1.6 examples/library.rb
yob-roxml-3.1.6 examples/library.rb
roxml-3.1.5 examples/library.rb
roxml-3.1.4 examples/library.rb
roxml-3.1.3 examples/library.rb
roxml-3.1.2 examples/library.rb