Class: Atom::Person
Overview
Atom::Person
This class represents person construct Use this for ‘author’ or ‘contributor’ elements. You also can use Atom::Author or Atom::Contributor directly for each element, But this class can be converted to each class’s object easily with ‘to_author’ or ‘to_contributor’ method.
Example:
person = Atom::Person.new
person.name = "John"
person.email = "[email protected]"
person.url = "http://example.com/"
entry = Atom::Entry.new
entry. person.
entry.add_contributor person.to_contributor
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Element
Instance Method Summary collapse
-
#to_author ⇒ Object
Convert to an Atom::Author object.
-
#to_contributor ⇒ Object
Convert to an Atom::Contributor object.
Methods inherited from Element
#add, element_attr_accessor, element_attr_accessors, element_datetime_accessor, element_datetime_accessors, element_name, element_ns, element_object_list_accessor, element_text_accessor, element_text_accessors, element_text_list_accessor, #get, #get_attr, #get_object, #get_objects, #getlist, #initialize, new, ns, #set, #set_attr, #to_s
Constructor Details
This class inherits a constructor from Atom::Element
Instance Method Details
#to_author ⇒ Object
Convert to an Atom::Author object
632 633 634 635 636 637 638 |
# File 'lib/atomutil.rb', line 632 def = Author.new .name = self.name .email = self.email unless self.email.nil? .uri = self.uri unless self.uri.nil? end |
#to_contributor ⇒ Object
Convert to an Atom::Contributor object
640 641 642 643 644 645 646 |
# File 'lib/atomutil.rb', line 640 def to_contributor contributor = Contributor.new contributor.name = self.name contributor.email = self.email unless self.email.nil? contributor.uri = self.uri unless self.uri.nil? contributor end |