Class: Svnx::Base::Command
- Inherits:
-
Object
- Object
- Svnx::Base::Command
show all
- Includes:
- Logue::Loggable
- Defined in:
- lib/svnx/base/command.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options, cmdlinecls: nil, caching: caching?
) ⇒ Command
Returns a new instance of Command.
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/svnx/base/command.rb', line 32
def initialize options, cmdlinecls: nil, caching: caching?
cmdargs = read_options options
if cmdlinecls
@cmdline = cmdlinecls.new subcommand: subcommand, xml: xml?, caching: caching, args: cmdargs
else
cmdfactory = CommandFactory.new
clfactory = cmdfactory.command_line_factory
@cmdline = clfactory.create subcommand: subcommand, xml: xml?, caching: caching, args: cmdargs
end
@output = @cmdline.execute
@error = @cmdline.error
@status = @cmdline.status
end
|
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
29
30
31
|
# File 'lib/svnx/base/command.rb', line 29
def error
@error
end
|
#output ⇒ Object
Returns the value of attribute output.
28
29
30
|
# File 'lib/svnx/base/command.rb', line 28
def output
@output
end
|
#status ⇒ Object
Returns the value of attribute status.
30
31
32
|
# File 'lib/svnx/base/command.rb', line 30
def status
@status
end
|
Class Method Details
.caching ⇒ Object
15
16
17
18
19
|
# File 'lib/svnx/base/command.rb', line 15
def caching
define_method :caching? do
true
end
end
|
.noncaching ⇒ Object
21
22
23
24
25
|
# File 'lib/svnx/base/command.rb', line 21
def noncaching
define_method :caching? do
false
end
end
|
Instance Method Details
#options_class ⇒ Object
57
58
59
60
|
# File 'lib/svnx/base/command.rb', line 57
def options_class
modl = ClassUtil.find_module self.class
modl::Options
end
|
#read_options(args) ⇒ Object
52
53
54
55
|
# File 'lib/svnx/base/command.rb', line 52
def read_options args
opts = options_class.new args
opts.to_args
end
|
#subcommand ⇒ Object
62
63
64
65
|
# File 'lib/svnx/base/command.rb', line 62
def subcommand
melements = ClassUtil.module_elements self.class
melements[-1].downcase
end
|
#xml? ⇒ Boolean
48
49
50
|
# File 'lib/svnx/base/command.rb', line 48
def xml?
false
end
|