Class: Lotus::Category

Inherits:
Object
  • Object
show all
Defined in:
lib/lotus/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
29
30
31
32
# File 'lib/lotus/category.rb', line 26

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

Instance Attribute Details

#baseObject (readonly)

Holds the base URI for relative URIs contained in scheme.



7
8
9
# File 'lib/lotus/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/lotus/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/lotus/category.rb', line 12

def lang
  @lang
end

#schemeObject (readonly)

Holds the optional scheme used for categorization.



15
16
17
# File 'lib/lotus/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/lotus/category.rb', line 19

def term
  @term
end

Instance Method Details

#to_hashObject

Yields a Hash that represents this category.



35
36
37
38
39
40
41
42
43
# File 'lib/lotus/category.rb', line 35

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