Class: MatrixQQ::QQ::ForwardGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/matrix_qq/qq/forward_group/main.rb,
lib/matrix_qq/qq/forward_group/matrix.rb

Overview

send group massage to other

Defined Under Namespace

Classes: Matrix

Class Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dbus, matrix, info) ⇒ ForwardGroup

Returns a new instance of ForwardGroup.



10
11
12
13
14
# File 'lib/matrix_qq/qq/forward_group/main.rb', line 10

def initialize(dbus, matrix, info)
  @dbus = dbus
  @info = info
  @matrix = matrix
end

Class Attribute Details

.send_toObject

Returns the value of attribute send_to.



6
7
8
# File 'lib/matrix_qq/qq/forward_group/main.rb', line 6

def send_to
  @send_to
end

Instance Method Details

#call_module(room, type) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/matrix_qq/qq/forward_group/main.rb', line 26

def call_module(room, type)
  ForwardGroup.send_to[type.to_s].each do |func|
    puts "Start #{func.name}" if $VERBOSE
    func.new(@dbus, @matrix, @info, room).run
    puts "End #{func.name}" if $VERBOSE
  end
end

#runObject



16
17
18
19
20
21
22
23
24
# File 'lib/matrix_qq/qq/forward_group/main.rb', line 16

def run
  return unless @info.is_a? Hash
  tunnel = Config[:tunnel][@info['group_id'].to_s]
  return if tunnel.nil?
  return unless tunnel[:type] == 'group'
  tunnel[:to].each_pair do |room, type|
    call_module(room, type)
  end
end