Class: EAC::Person::Name

Inherits:
Object
  • Object
show all
Defined in:
lib/eac.rb

Defined Under Namespace

Classes: Part

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ Name

Returns a new instance of Name.



91
92
93
94
95
96
97
# File 'lib/eac.rb', line 91

def initialize(xml)
  @parts = []
  xml_parts = xml.xpath('ns:part', ns:'urn:isbn:1-931666-33-4')
  xml_parts.each do |part_data|
    @parts << Part.new(part_data)
  end
end

Instance Attribute Details

#partsObject (readonly)

Returns the value of attribute parts.



89
90
91
# File 'lib/eac.rb', line 89

def parts
  @parts
end

Instance Method Details

#to_sObject



99
100
101
# File 'lib/eac.rb', line 99

def to_s
  @parts.map(&:text).join(', ')
end