Class: Atom::Person
Overview
Represents a Person as defined by the Atom Syndication Format specification.
A Person is used for all author and contributor attributes.
See also www.atomenabled.org/developers/syndication/atom-format-spec.php#atomPersonConstruct
Instance Method Summary collapse
-
#initialize(o = {}) {|_self| ... } ⇒ Person
constructor
Initialize a new person.
- #inspect ⇒ Object
Methods included from Xml::Parseable
#==, #accessor_name, #current_node_is?, included, #next_node_is?, #parse, #to_xml
Constructor Details
#initialize(o = {}) {|_self| ... } ⇒ Person
Initialize a new person.
o
-
An XML::Reader object or a hash. Valid hash keys are
:name
,:uri
and:email
.
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/atom.rb', line 150 def initialize(o = {}) case o when XML::Reader o.read parse(o) when Hash o.each do |k, v| self.send("#{k.to_s}=", v) end else raise ArgumentError, "Got #{o.class} but expected a Hash or XML::Reader" end yield(self) if block_given? end |
Instance Method Details
#inspect ⇒ Object
166 167 168 |
# File 'lib/atom.rb', line 166 def inspect "<Atom::Person name:'#{name}' uri:'#{uri}' email:'#{email}" end |