Class: Atig::Command::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/atig/command/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, gateway, api, db) ⇒ Command

Returns a new instance of Command.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/atig/command/command.rb', line 6

def initialize(context, gateway, api, db)
  @log     = context.log
  @opts    = context.opts
  @gateway = gateway
  @api     = api
  @db      = db
  @gateway.ctcp_action(*command_name) do |target, mesg, command, args|
    action(target, mesg, command, args){|m|
      gateway[target].notify m
    }
  end
end

Instance Attribute Details

#apiObject (readonly)

Returns the value of attribute api.



5
6
7
# File 'lib/atig/command/command.rb', line 5

def api
  @api
end

#dbObject (readonly)

Returns the value of attribute db.



5
6
7
# File 'lib/atig/command/command.rb', line 5

def db
  @db
end

#gatewayObject (readonly)

Returns the value of attribute gateway.



5
6
7
# File 'lib/atig/command/command.rb', line 5

def gateway
  @gateway
end

#optsObject (readonly)

Returns the value of attribute opts.



5
6
7
# File 'lib/atig/command/command.rb', line 5

def opts
  @opts
end

Instance Method Details

#find_by_tid(tid) ⇒ Object



19
20
21
# File 'lib/atig/command/command.rb', line 19

def find_by_tid(tid)
  @db.statuses.find_by_tid tid
end