Class: ActiveMatrix::Bot::Base::RequestHandler

Inherits:
Struct
  • Object
show all
Defined in:
lib/active_matrix/bot/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commandObject

Returns the value of attribute command

Returns:

  • (Object)

    the current value of command



10
11
12
# File 'lib/active_matrix/bot/base.rb', line 10

def command
  @command
end

#dataObject

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



10
11
12
# File 'lib/active_matrix/bot/base.rb', line 10

def data
  @data
end

#procObject

Returns the value of attribute proc

Returns:

  • (Object)

    the current value of proc



10
11
12
# File 'lib/active_matrix/bot/base.rb', line 10

def proc
  @proc
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



10
11
12
# File 'lib/active_matrix/bot/base.rb', line 10

def type
  @type
end

Instance Method Details

#arityObject



19
20
21
22
23
# File 'lib/active_matrix/bot/base.rb', line 19

def arity
  arity = self.proc.parameters.count { |t, _| %i[opt req].include? t }
  arity = -arity if self.proc.parameters.any? { |t, _| t.to_s.include? 'rest' }
  arity
end

#command?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/active_matrix/bot/base.rb', line 11

def command?
  type == :command
end

#event?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/active_matrix/bot/base.rb', line 15

def event?
  type == :event
end