Class: HubotGf::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/hubotgf/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Command

Returns a new instance of Command.



6
7
8
9
# File 'lib/hubotgf/command.rb', line 6

def initialize(hash)
  @regex   = hash.keys.first
  @_method = hash.values.first
end

Instance Attribute Details

#_methodObject

Returns the value of attribute _method.



4
5
6
# File 'lib/hubotgf/command.rb', line 4

def _method
  @_method
end

#regexObject

Returns the value of attribute regex.



4
5
6
# File 'lib/hubotgf/command.rb', line 4

def regex
  @regex
end

#textObject

Returns the value of attribute text.



4
5
6
# File 'lib/hubotgf/command.rb', line 4

def text
  @text
end

Instance Method Details

#argumentsObject



11
12
13
# File 'lib/hubotgf/command.rb', line 11

def arguments
  regex.match(text).captures
end