Class: Balmora::Command::Links
Defined Under Namespace
Classes: Error
Instance Method Summary
collapse
#_execute, #execute, #initialize, #option
Instance Method Details
#_get_command(link) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/balmora/command/links.rb', line 33
def _get_command(link)
command = (@options || {}).merge(command: 'link', link: link)
if link.instance_of?(::Hash)
command.merge!(link)
end
command.merge!(storage: @storage)
return command
end
|
#init ⇒ Object
5
6
7
8
9
10
|
# File 'lib/balmora/command/links.rb', line 5
def init()
super()
@links = @variables.inject(@links)
@storage = @variables.inject(@storage)
end
|
#options ⇒ Object
12
13
14
|
# File 'lib/balmora/command/links.rb', line 12
def options()
return super().concat([:links, :storage])
end
|
#run ⇒ Object
26
27
28
29
30
31
|
# File 'lib/balmora/command/links.rb', line 26
def run()
@links.each() { |link|
command = _get_command(link)
@balmora.run_command(@state, command)
}
end
|
#verify ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/balmora/command/links.rb', line 16
def verify()
if @links.nil?()
raise Error.new('"links" should be defined')
end
if @storage.nil?()
raise Error.new('"storage" should be defined')
end
end
|