Class: Atom::Category

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

Overview

Represents a Category as defined by the Atom Syndication Format specification.

Instance Attribute Summary

Attributes included from SimpleExtensions

#simple_extensions

Instance Method Summary collapse

Methods included from SimpleExtensions

#[]

Methods included from Xml::Parseable

#==, #accessor_name, #current_node_is?, included, #next_node_is?, #parse, #to_xml

Constructor Details

#initialize(o = {}) {|_self| ... } ⇒ Category

Returns a new instance of Category.

Yields:

  • (_self)

Yield Parameters:



123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/atom.rb', line 123

def initialize(o = {})
  case o
  when Nokogiri::XML::Reader
    parse(o, :once => true)
  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