Module: Gamefic::Overlookable
- Defined in:
- lib/gamefic/overlookable.rb,
lib/gamefic/overlookable/version.rb
Overview
A mixin for implementing nouns as Scenery with a default description.
Constant Summary collapse
- VERSION =
'1.0.0'
Instance Method Summary collapse
-
#overlook(*names, type: Scenery) ⇒ Array<Entity>
Create Scenery that provides a default description for unimplemented words.
-
#rubble=(names) ⇒ void
A shortcut to overlookable Rubble that can be called from ‘make` parameters.
-
#scenery=(names) ⇒ void
A shortcut to overlookable Scenery that can be called from ‘make` parameters.
Instance Method Details
#overlook(*names, type: Scenery) ⇒ Array<Entity>
Create Scenery that provides a default description for unimplemented words. Names can include two slashes (//) to add a list of synonyms.
The type of overlookable entity can be modified with the ‘type` parameter. For compatibility with the gamefic-standard library, it is recommended to use either `Scenery` or `Rubble`.
38 39 40 41 42 43 44 45 |
# File 'lib/gamefic/overlookable.rb', line 38 def overlook *names, type: Scenery names.map do |input| parts = input.split('//') name = parts[0].to_s.strip synonyms = parts[1].to_s.strip type.new(name: name, synonyms: synonyms, parent: self) end end |
#rubble=(names) ⇒ void
This method returns an undefined value.
A shortcut to overlookable Rubble that can be called from ‘make` parameters.
69 70 71 |
# File 'lib/gamefic/overlookable.rb', line 69 def rubble= names overlook(*names, type: Rubble) end |
#scenery=(names) ⇒ void
This method returns an undefined value.
A shortcut to overlookable Scenery that can be called from ‘make` parameters.
56 57 58 |
# File 'lib/gamefic/overlookable.rb', line 56 def scenery= names overlook(*names, type: Scenery) end |