Class: VORuby::VOEvent::V1_1::Who
- Defined in:
- lib/voruby/voevent/1.1/voevent.rb
Defined Under Namespace
Classes: AuthorList, DateTimeList, IVORNList
Instance Attribute Summary collapse
-
#author_ivorns ⇒ Object
Returns the value of attribute author_ivorns.
-
#authors ⇒ Object
Returns the value of attribute authors.
-
#dates ⇒ Object
Returns the value of attribute dates.
Attributes inherited from Described
Class Method Summary collapse
Instance Method Summary collapse
- #==(w) ⇒ Object
-
#initialize(author_ivorns, dates, authors = nil, descriptions = nil, references = nil) ⇒ Who
constructor
A new instance of Who.
- #to_xml(name = nil) ⇒ Object
Methods inherited from Described
Methods included from SerializableToXml
Constructor Details
#initialize(author_ivorns, dates, authors = nil, descriptions = nil, references = nil) ⇒ Who
Returns a new instance of Who.
916 917 918 919 920 921 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 916 def initialize(, dates, =nil, descriptions=nil, references=nil) super(descriptions, references) self. = self.dates = dates self. = end |
Instance Attribute Details
#author_ivorns ⇒ Object
Returns the value of attribute author_ivorns.
914 915 916 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 914 def @author_ivorns end |
#authors ⇒ Object
Returns the value of attribute authors.
914 915 916 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 914 def @authors end |
#dates ⇒ Object
Returns the value of attribute dates.
914 915 916 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 914 def dates @dates end |
Class Method Details
.from_xml(xml) ⇒ Object
978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 978 def self.from_xml(xml) root = element_from(xml) = REXML::XPath.match(root, 'x:AuthorIVORN', {'x' => obj_ns.uri}) = nil if .size == 0 dates = REXML::XPath.match(root, 'x:Date', {'x' => obj_ns.uri}) dates = nil if dates.size == 0 = REXML::XPath.match(root, 'x:Author', {'x' => obj_ns.uri}) = nil if .size == 0 self.new( ? IVORNList.new(.collect{ |i| URI.parse(i.text) }) : nil, dates ? DateTimeList.new(dates.collect{ |d| DateTime.parse(d.text) }) : nil, ? AuthorList.new(.collect{ |a| Author.from_xml(a) }) : nil, *Described.described_from_xml(root) ) end |
Instance Method Details
#==(w) ⇒ Object
950 951 952 953 954 955 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 950 def ==(w) super(w) and self. == w. and self.dates == w.dates and self. == w. end |
#to_xml(name = nil) ⇒ Object
957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 |
# File 'lib/voruby/voevent/1.1/voevent.rb', line 957 def to_xml(name=nil) el = super(name) self..each{ |i| e = REXML::Element.new("#{obj_ns.prefix}:AuthorIVORN") e.text = i.to_s el.add_element(e) } if self. self.dates.each{ |d| e = REXML::Element.new("#{obj_ns.prefix}:Date") e.text = d.to_s el.add_element(e) } if self.dates self..each{ |a| el.add_element(a.to_xml('Author')) } if self. collapse_namespaces(el) el end |