Class: Lotus::Category
- Inherits:
-
Object
- Object
- Lotus::Category
- 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
-
#base ⇒ Object
readonly
Holds the base URI for relative URIs contained in scheme.
-
#label ⇒ Object
readonly
Holds the string that provides a human-readable label for display in end-user applications.
-
#lang ⇒ Object
readonly
Holds the language of term and label, when it exists.
-
#scheme ⇒ Object
readonly
Holds the optional scheme used for categorization.
-
#term ⇒ Object
readonly
Holds the string identifying the category to which the entry or feed belongs.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Category
constructor
Create a Category to apply to a feed or entry.
-
#to_hash ⇒ Object
Yields a Hash that represents this category.
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( = {}) @base = [:base] @lang = [:lang] @scheme = [:scheme] @term = [:term] @label = [:label] end |
Instance Attribute Details
#base ⇒ Object (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 |
#label ⇒ Object (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 |
#lang ⇒ Object (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 |
#scheme ⇒ Object (readonly)
Holds the optional scheme used for categorization.
15 16 17 |
# File 'lib/lotus/category.rb', line 15 def scheme @scheme end |
#term ⇒ Object (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_hash ⇒ Object
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 |