Class: Nelumba::Category

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

Overview

This element conveys information about a category associated with an entry or feed. There is no defined meaning to the content according to the Atom specification.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Category

Create a Category to apply to a feed or entry.



26
27
28
# File 'lib/nelumba/category.rb', line 26

def initialize(options = {})
  init(options)
end

Instance Attribute Details

#baseObject (readonly)

Holds the base URI for relative URIs contained in scheme.



7
8
9
# File 'lib/nelumba/category.rb', line 7

def base
  @base
end

#labelObject (readonly)

Holds the string that provides a human-readable label for display in end-user applications. The content of this field is language sensitive.



23
24
25
# File 'lib/nelumba/category.rb', line 23

def label
  @label
end

#langObject (readonly)

Holds the language of term and label, when it exists. The language should be specified as RFC 3066 as either 2 or 3 letter codes. For example: ‘en’ for English or more specifically ‘en-us’



12
13
14
# File 'lib/nelumba/category.rb', line 12

def lang
  @lang
end

#schemeObject (readonly)

Holds the optional scheme used for categorization.



15
16
17
# File 'lib/nelumba/category.rb', line 15

def scheme
  @scheme
end

#termObject (readonly)

Holds the string identifying the category to which the entry or feed belongs.



19
20
21
# File 'lib/nelumba/category.rb', line 19

def term
  @term
end

Instance Method Details

#init(options = {}) ⇒ Object



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

def init(options = {})
  @base = options[:base]
  @lang = options[:lang]
  @scheme = options[:scheme]
  @term = options[:term]
  @label = options[:label]
end

#to_hashObject

Yields a Hash that represents this category.



39
40
41
42
43
44
45
46
47
# File 'lib/nelumba/category.rb', line 39

def to_hash
  {
    :base => @base,
    :lang => @lang,
    :scheme => @scheme,
    :term => @term,
    :label => @label
  }
end