Class: Droonga::Command

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method_name, options) ⇒ Command

Returns a new instance of Command.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :pattern (Array)

    The pattern to be matched against message. If the pattern is matched to a message, the command will be applied.

See Also:



26
27
28
29
30
# File 'lib/droonga/command.rb', line 26

def initialize(method_name, options)
  @method_name = method_name
  @options = options
  @matcher = MessageMatcher.new(@options[:pattern])
end

Instance Attribute Details

#method_nameObject (readonly)

Returns the value of attribute method_name.



20
21
22
# File 'lib/droonga/command.rb', line 20

def method_name
  @method_name
end

Instance Method Details

#match?(message) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/droonga/command.rb', line 32

def match?(message)
  @matcher.match?(message)
end