Class: OsCtld::UserControl::Commands::Base

Inherits:
Commands::Base show all
Defined in:
lib/osctld/user_control/commands/base.rb

Instance Attribute Summary collapse

Attributes inherited from Commands::Base

#client, #client_handler, #id, #opts

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Commands::Base

#base_execute, #call_cmd, #call_cmd!, #error, #error!, #execute, #handled, #indirect?, #manipulate, #manipulation_holder, #ok, #progress, #request_stop, run!

Constructor Details

#initialize(user, opts) ⇒ Base

rubocop:disable Lint/MissingSuper



16
17
18
19
# File 'lib/osctld/user_control/commands/base.rb', line 16

def initialize(user, opts) # rubocop:disable Lint/MissingSuper
  @user = user
  @opts = opts
end

Instance Attribute Details

#userObject (readonly)

Returns the value of attribute user.



14
15
16
# File 'lib/osctld/user_control/commands/base.rb', line 14

def user
  @user
end

Class Method Details

.handle(name) ⇒ Object



5
6
7
# File 'lib/osctld/user_control/commands/base.rb', line 5

def self.handle(name)
  UserControl::Command.register(name, self)
end

.run(user, opts = {}) ⇒ Object



9
10
11
12
# File 'lib/osctld/user_control/commands/base.rb', line 9

def self.run(user, opts = {})
  c = new(user, opts)
  c.execute
end

Instance Method Details

#owns_ct?(ct) ⇒ Boolean (protected)

Returns:

  • (Boolean)


23
24
25
# File 'lib/osctld/user_control/commands/base.rb', line 23

def owns_ct?(ct)
  ct.user == user
end