Module: Gamefic::Scriptable::Syntaxes
- Included in:
- Gamefic::Scriptable, Responses
- Defined in:
- lib/gamefic/scriptable/syntaxes.rb
Instance Method Summary collapse
-
#interpret(command, translation) ⇒ Syntax
Create an alternate Syntax for a response.
- #syntaxes ⇒ Object
Instance Method Details
#interpret(command, translation) ⇒ Syntax
Create an alternate Syntax for a response. The command and its translation can be parameterized.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gamefic/scriptable/syntaxes.rb', line 20 def interpret(command, translation) parts = Syntax.split(command) additions = if parts.first.include?('|') parts.first.split('|').map { |verb| Syntax.new("#{verb} #{verb[1..].join(' ')}", translation) } else [Syntax.new(command, translation)] end syntaxes.concat additions additions end |
#syntaxes ⇒ Object
31 32 33 |
# File 'lib/gamefic/scriptable/syntaxes.rb', line 31 def syntaxes @syntaxes ||= [] end |