Class: Angus::SDoc::Definitions::Glossary
- Inherits:
-
Object
- Object
- Angus::SDoc::Definitions::Glossary
- Defined in:
- lib/angus/definitions/glossary.rb
Instance Attribute Summary collapse
-
#terms ⇒ GlossaryTerm
The terms of the glossary.
Instance Method Summary collapse
-
#initialize(terms_hash = {}) ⇒ Glossary
constructor
Initializes a new Glossary and its terms.
-
#terms_hash ⇒ Hash<String, GlossaryTerm>
Returns a hash with short name as key and the term as the value.
-
#terms_hash_with_long_names ⇒ Hash<String, GlossaryTerm>
Returns a hash with long name as key and the term as the value.
Constructor Details
#initialize(terms_hash = {}) ⇒ Glossary
Initializes a new Glossary and its terms.
22 23 24 |
# File 'lib/angus/definitions/glossary.rb', line 22 def initialize(terms_hash = {}) @terms = Angus::SDoc::Definitions::GlossaryTerm.build_from_hash(terms_hash) end |
Instance Attribute Details
#terms ⇒ GlossaryTerm
Returns The terms of the glossary.
7 8 9 |
# File 'lib/angus/definitions/glossary.rb', line 7 def terms @terms end |
Instance Method Details
#terms_hash ⇒ Hash<String, GlossaryTerm>
Returns a hash with short name as key and the term as the value.
29 30 31 32 33 34 35 36 37 |
# File 'lib/angus/definitions/glossary.rb', line 29 def terms_hash hash = {} @terms.each do |term| hash[term.short_name] = term end hash end |
#terms_hash_with_long_names ⇒ Hash<String, GlossaryTerm>
Returns a hash with long name as key and the term as the value.
42 43 44 45 46 47 48 |
# File 'lib/angus/definitions/glossary.rb', line 42 def terms_hash_with_long_names hash = {} @terms.each do |term| hash[term.long_name] = term end hash end |