Module: MatrixSdk::Bot::Delegator

Defined in:
lib/matrix_sdk/bot/main.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.targetObject

Returns the value of attribute target.



66
67
68
# File 'lib/matrix_sdk/bot/main.rb', line 66

def target
  @target
end

Class Method Details

.delegate(*methods) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/matrix_sdk/bot/main.rb', line 48

def self.delegate(*methods)
  methods.each do |method_name|
    define_method(method_name) do |*args, &block|
      return super(*args, &block) if respond_to? method_name

      Delegator.target.send(method_name, *args, &block)
    end
    # ensure keyword argument passing is compatible with ruby >= 2.7
    ruby2_keywords(method_name) if respond_to?(:ruby2_keywords, true)
    private method_name
  end
end