Class: Unbelievable::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/unbelievable/generator.rb

Direct Known Subclasses

Haiku, Lorem, Secret, Todo

Constant Summary collapse

@@dictionary =
{}

Instance Method Summary collapse

Constructor Details

#initialize(style = default_style) ⇒ Generator

Returns a new instance of Generator.



12
13
14
15
# File 'lib/unbelievable/generator.rb', line 12

def initialize(style = default_style)
  file_name = "#{File.dirname(__FILE__)}/dictionary/#{style}.json"
  @@dictionary[style] ||= File.open(file_name) { |f| JSON.load(f) }
end