Class: Nelumba::Atom::Category

Inherits:
Atom::Category
  • Object
show all
Defined in:
lib/nelumba/atom/category.rb

Overview

This class represents an Nelumba Category object.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_canonical(obj) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/nelumba/atom/category.rb', line 17

def self.from_canonical(obj)
  hash = obj.to_hash
  if hash[:base]
    hash[:xml_base] = hash[:base]
  end
  if hash[:lang]
    hash[:xml_lang] = hash[:lang]
  end
  hash.delete :base
  hash.delete :lang
  self.new(hash)
end

Instance Method Details

#to_canonicalObject



30
31
32
33
34
35
36
# File 'lib/nelumba/atom/category.rb', line 30

def to_canonical
  Nelumba::Category.new(:base   => self.xml_base,
                      :lang   => self.xml_lang,
                      :scheme => self.scheme,
                      :lable  => self.label,
                      :term   => self.term)
end