Class: Lotus::Generator
- Inherits:
-
Object
- Object
- Lotus::Generator
- Defined in:
- lib/lotus/generator.rb
Overview
The generator element identifies the agent used to generate the feed.
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Holds the base URI for relative URIs contained in uri.
-
#lang ⇒ Object
readonly
Holds the language of the name, when it exists.
-
#name ⇒ Object
readonly
Holds the string that provides a human-readable name that identifies the generating agent.
-
#uri ⇒ Object
readonly
Holds the optional uri that SHOULD produce a representation that is relevant to the agent.
-
#version ⇒ Object
readonly
Holds the optional string identifying the version of the generating agent.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Generator
constructor
Creates a representation of a generator.
-
#to_hash ⇒ Object
Yields a hash that represents the generator.
Constructor Details
#initialize(options = {}) ⇒ Generator
Creates a representation of a generator.
options:
:base => Optional base URI for use with a relative URI in uri.
:lang => Optional string identifying the language of the name field.
:uri => Optional string identifying the URL that SHOULD produce
a representation that is relevant to the agent.
:version => Optional string indicating the version of the generating
agent.
:name => Optional name of the agent.
34 35 36 37 38 39 40 |
# File 'lib/lotus/generator.rb', line 34 def initialize( = {}) @base = [:base] @lang = [:lang] @uri = [:uri] @version = [:version] @name = [:name] end |
Instance Attribute Details
#base ⇒ Object (readonly)
Holds the base URI for relative URIs contained in uri.
5 6 7 |
# File 'lib/lotus/generator.rb', line 5 def base @base end |
#lang ⇒ Object (readonly)
Holds the language of the name, 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’
10 11 12 |
# File 'lib/lotus/generator.rb', line 10 def lang @lang end |
#name ⇒ Object (readonly)
Holds the string that provides a human-readable name that identifies the generating agent. The content of this field is language sensitive.
22 23 24 |
# File 'lib/lotus/generator.rb', line 22 def name @name end |
#uri ⇒ Object (readonly)
Holds the optional uri that SHOULD produce a representation that is relevant to the agent.
14 15 16 |
# File 'lib/lotus/generator.rb', line 14 def uri @uri end |
#version ⇒ Object (readonly)
Holds the optional string identifying the version of the generating agent.
18 19 20 |
# File 'lib/lotus/generator.rb', line 18 def version @version end |
Instance Method Details
#to_hash ⇒ Object
Yields a hash that represents the generator.
43 44 45 46 47 48 49 50 51 |
# File 'lib/lotus/generator.rb', line 43 def to_hash { :base => self.base, :lang => self.lang, :version => self.version, :uri => self.uri, :name => self.name } end |