Class: SlackGame::Controller::InputParser
- Inherits:
-
Object
- Object
- SlackGame::Controller::InputParser
- Defined in:
- lib/slack_game/controller.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Instance Method Summary collapse
-
#initialize(command, pattern) ⇒ InputParser
constructor
A new instance of InputParser.
- #match?(input) ⇒ Boolean
Constructor Details
#initialize(command, pattern) ⇒ InputParser
Returns a new instance of InputParser.
48 49 50 51 |
# File 'lib/slack_game/controller.rb', line 48 def initialize(command, pattern) @command = command @pattern = pattern end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
46 47 48 |
# File 'lib/slack_game/controller.rb', line 46 def command @command end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
46 47 48 |
# File 'lib/slack_game/controller.rb', line 46 def pattern @pattern end |
Instance Method Details
#match?(input) ⇒ Boolean
53 54 55 |
# File 'lib/slack_game/controller.rb', line 53 def match?(input) !! pattern.match(input) end |