class KeywordSearch::Definition::Keyword
Attributes
description[R]
handler[R]
name[R]
Public Class Methods
new(name, description=nil, &handler)
click to toggle source
# File lib/keyword_search/definition.rb, line 8 def initialize(name, description=nil, &handler) @name, @description = name, description @handler = handler end
Public Instance Methods
handle(value, sign)
click to toggle source
# File lib/keyword_search/definition.rb, line 13 def handle(value, sign) # If the handler is only expecting one argument, # only give them the positive matches if handler.arity == 1 handler.call(value) if sign else handler.call(value, sign) end end