Class: GrimObject::Generator
- Inherits:
-
Object
- Object
- GrimObject::Generator
- Defined in:
- lib/grim-object.rb
Constant Summary collapse
- @@descriptors =
[]
- @@places =
[]
Instance Method Summary collapse
-
#initialize ⇒ Generator
constructor
A new instance of Generator.
- #name ⇒ Object
Constructor Details
#initialize ⇒ Generator
Returns a new instance of Generator.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/grim-object.rb', line 7 def initialize data = YAML.load_file "lib/locations.yml" yaml_descriptors = data["descriptors"] yaml_places = data["places"] yaml_descriptors.each do |descriptor| @@descriptors.push(descriptor) end yaml_places.each do |place| @@places.push(place) end end |
Instance Method Details
#name ⇒ Object
18 19 20 |
# File 'lib/grim-object.rb', line 18 def name "#{@@descriptors.sample}-#{@@places.sample}-#{rand(1000..9999).floor}" end |