Class: Chronic::Dictionary
- Inherits:
-
Object
- Object
- Chronic::Dictionary
- Defined in:
- lib/chronic/dictionary.rb
Overview
A collection of definitions
Direct Known Subclasses
Instance Attribute Summary collapse
-
#defined_items ⇒ Object
readonly
Returns the value of attribute defined_items.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#definitions ⇒ Object
returns a hash of each word’s Definitions.
-
#initialize(options = {}) ⇒ Dictionary
constructor
A new instance of Dictionary.
Constructor Details
#initialize(options = {}) ⇒ Dictionary
Returns a new instance of Dictionary.
8 9 10 11 |
# File 'lib/chronic/dictionary.rb', line 8 def initialize( = {}) @options = @defined_items = [] end |
Instance Attribute Details
#defined_items ⇒ Object (readonly)
Returns the value of attribute defined_items.
6 7 8 |
# File 'lib/chronic/dictionary.rb', line 6 def defined_items @defined_items end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/chronic/dictionary.rb', line 6 def @options end |
Instance Method Details
#definitions ⇒ Object
returns a hash of each word’s Definitions
14 15 16 17 18 19 |
# File 'lib/chronic/dictionary.rb', line 14 def definitions defined_items.each_with_object({}) do |word, defs| word_type = "#{word.capitalize.to_s + 'Definitions'}" defs[word] = Chronic.const_get(word_type).new().definitions end end |