Class: Hipbot::ReactionFactory

Inherits:
Struct
  • Object
show all
Defined in:
lib/hipbot/reaction_factory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#reactable=(value) ⇒ Object

Sets the attribute reactable

Parameters:

  • value (Object)

    the value to set the attribute reactable to.

Returns:

  • (Object)

    the newly set value



2
3
4
# File 'lib/hipbot/reaction_factory.rb', line 2

def reactable=(value)
  @reactable = value
end

Instance Method Details

#build(options_stack, block) ⇒ Object



6
7
8
9
10
11
# File 'lib/hipbot/reaction_factory.rb', line 6

def build(options_stack, block)
  options = get_options(options_stack)
  block ||= options.delete(:block)
  @current_description = nil
  Reaction.new(reactable, options, block)
end

#description(text) ⇒ Object



13
14
15
# File 'lib/hipbot/reaction_factory.rb', line 13

def description(text)
  @current_description = text
end

#get_reaction_options(params) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/hipbot/reaction_factory.rb', line 17

def get_reaction_options(params)
  options = params.extract_options!
  get_reaction_method_proc(params) do |block|
    options[:block] = block
  end
  options[:regexps] = params if params.any?
  options.merge(desc: current_description)
end