Class: SlackGame::Controller::InputParser

Inherits:
Object
  • Object
show all
Defined in:
lib/slack_game/controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#commandObject (readonly)

Returns the value of attribute command.



46
47
48
# File 'lib/slack_game/controller.rb', line 46

def command
  @command
end

#patternObject (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

Returns:

  • (Boolean)


53
54
55
# File 'lib/slack_game/controller.rb', line 53

def match?(input)
  !! pattern.match(input)
end