Class: MatrixSdk::Bot::Base::RequestHandler

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commandObject

Returns the value of attribute command



9
10
11
# File 'lib/matrix_sdk/bot/base.rb', line 9

def command
  @command
end

#dataObject

Returns the value of attribute data



9
10
11
# File 'lib/matrix_sdk/bot/base.rb', line 9

def data
  @data
end

#procObject

Returns the value of attribute proc



9
10
11
# File 'lib/matrix_sdk/bot/base.rb', line 9

def proc
  @proc
end

#typeObject

Returns the value of attribute type



9
10
11
# File 'lib/matrix_sdk/bot/base.rb', line 9

def type
  @type
end

Instance Method Details

#arityObject



18
19
20
21
22
# File 'lib/matrix_sdk/bot/base.rb', line 18

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



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

def command?
  type == :command
end

#event?Boolean



14
15
16
# File 'lib/matrix_sdk/bot/base.rb', line 14

def event?
  type == :event
end