Class: DnsMadeEasy::Runner
- Inherits:
-
Object
- Object
- DnsMadeEasy::Runner
- Defined in:
- lib/dnsmadeeasy/runner.rb
Constant Summary collapse
- SUPPORTED_FORMATS =
%w(json json_pretty yaml pp).freeze
- SUPPORTED_FORMAT_FLAGS =
SUPPORTED_FORMATS.map { |f| "--#{f}" }.freeze
Instance Attribute Summary collapse
-
#argv ⇒ Object
Returns the value of attribute argv.
-
#format ⇒ Object
Returns the value of attribute format.
-
#operation ⇒ Object
Returns the value of attribute operation.
Instance Method Summary collapse
- #execute! ⇒ Object
-
#initialize(argv = nil) ⇒ Runner
constructor
A new instance of Runner.
Constructor Details
#initialize(argv = nil) ⇒ Runner
19 20 21 22 |
# File 'lib/dnsmadeeasy/runner.rb', line 19 def initialize(argv = nil) self.argv = argv || ARGV.dup self.format = process_flags_format end |
Instance Attribute Details
#argv ⇒ Object
Returns the value of attribute argv.
17 18 19 |
# File 'lib/dnsmadeeasy/runner.rb', line 17 def argv @argv end |
#format ⇒ Object
Returns the value of attribute format.
17 18 19 |
# File 'lib/dnsmadeeasy/runner.rb', line 17 def format @format end |
#operation ⇒ Object
Returns the value of attribute operation.
17 18 19 |
# File 'lib/dnsmadeeasy/runner.rb', line 17 def operation @operation end |
Instance Method Details
#execute! ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/dnsmadeeasy/runner.rb', line 24 def execute! if argv.empty? || argv.empty? else configure_authentication self.operation = argv.shift.to_sym exit call_through_client(operation) end end |