Class: ADAssault::CLI::DNS::DUZDU::BaseAction
- Inherits:
-
Object
- Object
- ADAssault::CLI::DNS::DUZDU::BaseAction
show all
- Defined in:
- lib/adassault/cli/dns/duzdu/baseaction.rb
Overview
stuff common to all duzdu’s sub-commands
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options) ⇒ BaseAction
Returns a new instance of BaseAction.
16
17
18
19
20
|
# File 'lib/adassault/cli/dns/duzdu/baseaction.rb', line 16
def initialize(options)
parent_options = options.dig(GLI::Command::PARENT, GLI::Command::PARENT)
dns_opts = parent_options[:nameserver].nil? ? nil : { nameserver: [parent_options[:nameserver]] }
@duz = ADAssault::DNS::DUZDU.new(parent_options[:domain], dns_opts)
end
|
Class Method Details
.arguments ⇒ Object
39
40
41
|
# File 'lib/adassault/cli/dns/duzdu/baseaction.rb', line 39
def arguments
raise NotImplementedError, 'Sub-class must implement this method'
end
|
.command_name ⇒ Object
27
28
29
|
# File 'lib/adassault/cli/dns/duzdu/baseaction.rb', line 27
def command_name
name.split('::').last.downcase
end
|
.description ⇒ Object
31
32
33
|
# File 'lib/adassault/cli/dns/duzdu/baseaction.rb', line 31
def description
raise NotImplementedError, 'Sub-class must implement this method'
end
|
.long_description ⇒ Object
35
36
37
|
# File 'lib/adassault/cli/dns/duzdu/baseaction.rb', line 35
def long_description
raise NotImplementedError, 'Sub-class must implement this method'
end
|
.register(parent_command) ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/adassault/cli/dns/duzdu/baseaction.rb', line 43
def register(parent_command)
parent_command.desc description
parent_command.long_desc long_description unless long_description.empty?
arguments.each { |argument| parent_command.arg argument } parent_command.command command_name.to_sym do |cmd|
cmd.action do |_global_options, options, args|
action = new(options)
action.run(args)
end
end
end
|
Instance Method Details
#run(_args) ⇒ Object
22
23
24
|
# File 'lib/adassault/cli/dns/duzdu/baseaction.rb', line 22
def run(_args)
raise NotImplementedError, 'Sub-class must implement this method'
end
|