Class: Atom::Person

Inherits:
Object
  • Object
show all
Includes:
Xml::Parseable
Defined in:
lib/atom.rb

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

Constructor Details

#initialize(o = {}) ⇒ Person

Initialize a new person.

o

An XML::Reader object or a hash. Valid hash keys are :name, :uri and :email.



142
143
144
145
146
147
148
149
150
151
152
# File 'lib/atom.rb', line 142

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
  end
end

Instance Method Details

#inspectObject



154
155
156
# File 'lib/atom.rb', line 154

def inspect
  "<Atom::Person name:'#{name}' uri:'#{uri}' email:'#{email}"
end