class Gamefic::Action::Hook
Hooks are blocks of code that get executed before or after an actor performs an action. A before action hook is capable of cancelling the action’s performance.
Attributes
callback[R]
@param [Callback]
verbs[R]
@param [Array<Symbol>]
Public Class Methods
new(verbs, callback)
click to toggle source
# File lib/gamefic/action.rb, line 22 def initialize verbs, callback @verbs = verbs @callback = callback end
Public Instance Methods
match?(input)
click to toggle source
# File lib/gamefic/action.rb, line 27 def match?(input) verbs.empty? || verbs.include?(input) end