Class: Formats
- Inherits:
-
Object
- Object
- Formats
- Defined in:
- lib/formats.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize ⇒ Formats
constructor
A new instance of Formats.
- #loaded?(key) ⇒ Boolean
- #reset! ⇒ Object
Constructor Details
#initialize ⇒ Formats
Returns a new instance of Formats.
3 4 5 |
# File 'lib/formats.rb', line 3 def initialize @formats = {} end |
Instance Method Details
#[](key) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/formats.rb', line 7 def [](key) symbolized_key = key.to_sym if @formats.has_key?(symbolized_key) @formats[symbolized_key] else @formats[symbolized_key] = FileReader.read_format(symbolized_key) end end |
#loaded?(key) ⇒ Boolean
16 17 18 |
# File 'lib/formats.rb', line 16 def loaded?(key) @formats.has_key?(key.to_sym) end |
#reset! ⇒ Object
20 21 22 |
# File 'lib/formats.rb', line 20 def reset! @formats = {} end |