Class: Forgery::Formats

Inherits:
Object
  • Object
show all
Defined in:
lib/forgery/formats.rb

Instance Method Summary collapse

Constructor Details

#initializeFormats

Returns a new instance of Formats.


5
6
7
# File 'lib/forgery/formats.rb', line 5

def initialize
  @formats = {}
end

Instance Method Details

#[](key) ⇒ Object


9
10
11
12
# File 'lib/forgery/formats.rb', line 9

def [](key)
  symbolized_key = key.to_sym
  @formats[symbolized_key] ||= Forgery::Extend(FileReader.read_format(symbolized_key))
end

#loaded?(key) ⇒ Boolean

Returns:

  • (Boolean)

14
15
16
# File 'lib/forgery/formats.rb', line 14

def loaded?(key)
  @formats.has_key?(key.to_sym)
end

#reset!Object


18
19
20
# File 'lib/forgery/formats.rb', line 18

def reset!
  @formats = {}
end