Class: SSHClient::CommandBuilder
- Inherits:
-
Object
- Object
- SSHClient::CommandBuilder
show all
- Defined in:
- lib/ssh_client/command_builder.rb
Constant Summary
collapse
- SEPARATOR =
' '.freeze
Instance Method Summary
collapse
Constructor Details
Returns a new instance of CommandBuilder.
5
6
7
8
9
|
# File 'lib/ssh_client/command_builder.rb', line 5
def initialize(&blk)
@paths = []
@context = eval 'self', blk.binding
instance_eval(&blk)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'lib/ssh_client/command_builder.rb', line 21
def method_missing(*args)
return @context.send(*args) if @context.respond_to?(args.first, true)
name = args.shift
value = to_path args.map { |a| to_path a }
@paths.pop if @paths.last == value
@paths << to_path(name, value)
@paths.last
end
|
Instance Method Details
#run(*args) ⇒ Object
15
16
17
|
# File 'lib/ssh_client/command_builder.rb', line 15
def run(*args)
@paths << to_path(*args)
end
|
#to_a ⇒ Object
11
12
13
|
# File 'lib/ssh_client/command_builder.rb', line 11
def to_a
@paths
end
|