Class: Simultaneous::Command::CommandBase
- Inherits:
-
Object
- Object
- Simultaneous::Command::CommandBase
show all
- Defined in:
- lib/simultaneous/command.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(task, params = {}) ⇒ CommandBase
Returns a new instance of CommandBase.
24
25
26
27
|
# File 'lib/simultaneous/command.rb', line 24
def initialize(task, params={})
@task, @params = task, merge_params(task.params, params)
@task_name = task.name
end
|
Instance Attribute Details
#cmd ⇒ Object
Returns the value of attribute cmd.
22
23
24
|
# File 'lib/simultaneous/command.rb', line 22
def cmd
@cmd
end
|
#params ⇒ Object
Returns the value of attribute params.
22
23
24
|
# File 'lib/simultaneous/command.rb', line 22
def params
@params
end
|
#tag ⇒ Object
Returns the value of attribute tag.
22
23
24
|
# File 'lib/simultaneous/command.rb', line 22
def tag
@tag
end
|
#task ⇒ Object
Returns the value of attribute task.
22
23
24
|
# File 'lib/simultaneous/command.rb', line 22
def task
@task
end
|
Instance Method Details
#debug ⇒ Object
63
64
65
|
# File 'lib/simultaneous/command.rb', line 63
def debug()
"#{self.class.name.split("::").last} :#{@task_name}\n"
end
|
#domain ⇒ Object
41
42
43
|
# File 'lib/simultaneous/command.rb', line 41
def domain
@domain ||= ""
end
|
#domain=(domain) ⇒ Object
37
38
39
|
# File 'lib/simultaneous/command.rb', line 37
def domain=(domain)
@domain = domain
end
|
#dump ⇒ Object
29
30
31
|
# File 'lib/simultaneous/command.rb', line 29
def dump
Marshal.dump(self)
end
|
#merge_params(task_params, call_params) ⇒ Object
53
54
55
56
57
58
59
60
61
|
# File 'lib/simultaneous/command.rb', line 53
def merge_params(task_params, call_params)
params = task_params.to_a.inject({}) do |hash, (key, value)|
hash[key.to_s] = value; hash
end
call_params.each do |key, value|
params[key.to_s] = value
end if call_params
params
end
|
#namespaced_task_name ⇒ Object
49
50
51
|
# File 'lib/simultaneous/command.rb', line 49
def namespaced_task_name
"#{domain}/#{task_name}"
end
|
#run ⇒ Object
33
34
35
|
# File 'lib/simultaneous/command.rb', line 33
def run
end
|
#task_name ⇒ Object
45
46
47
|
# File 'lib/simultaneous/command.rb', line 45
def task_name
@task_name.to_s
end
|