Class: DnsMadeEasy::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/dnsmadeeasy/runner.rb

Constant Summary collapse

SUPPORTED_FORMATS =
%w(json json_pretty yaml pp)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv = nil) ⇒ Runner

Returns a new instance of Runner.



15
16
17
18
# File 'lib/dnsmadeeasy/runner.rb', line 15

def initialize(argv = nil)
  self.argv   = argv || ARGV.dup
  self.format = process_flags_format
end

Instance Attribute Details

#argvObject

Returns the value of attribute argv.



13
14
15
# File 'lib/dnsmadeeasy/runner.rb', line 13

def argv
  @argv
end

#formatObject

Returns the value of attribute format.



13
14
15
# File 'lib/dnsmadeeasy/runner.rb', line 13

def format
  @format
end

#operationObject

Returns the value of attribute operation.



13
14
15
# File 'lib/dnsmadeeasy/runner.rb', line 13

def operation
  @operation
end

Instance Method Details

#execute!Object



20
21
22
23
24
25
26
27
28
# File 'lib/dnsmadeeasy/runner.rb', line 20

def execute!
  if argv.empty? || argv.size < 1
    print_help_message
  else
    configure_authentication
    self.operation = argv.shift.to_sym
    exit call_through_client(operation)
  end
end