Class: Moose::Inventory::RuntimeOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/moose_inventory/runtime_options.rb

Overview

Small value object for resolved runtime CLI options.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv:, config:, env:, format:, flags:) ⇒ RuntimeOptions

Returns a new instance of RuntimeOptions.



9
10
11
12
13
14
15
16
# File 'lib/moose_inventory/runtime_options.rb', line 9

def initialize(argv:, config:, env:, format:, flags:)
  @argv = argv
  @config = config
  @env = env
  @format = format
  @ansible = flags[:ansible] == true
  @trace = flags[:trace] == true
end

Instance Attribute Details

#argvObject (readonly)

Returns the value of attribute argv.



7
8
9
# File 'lib/moose_inventory/runtime_options.rb', line 7

def argv
  @argv
end

#configObject (readonly)

Returns the value of attribute config.



7
8
9
# File 'lib/moose_inventory/runtime_options.rb', line 7

def config
  @config
end

#envObject (readonly)

Returns the value of attribute env.



7
8
9
# File 'lib/moose_inventory/runtime_options.rb', line 7

def env
  @env
end

#formatObject (readonly)

Returns the value of attribute format.



7
8
9
# File 'lib/moose_inventory/runtime_options.rb', line 7

def format
  @format
end

Instance Method Details

#ansible?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/moose_inventory/runtime_options.rb', line 18

def ansible?
  @ansible
end

#output_formatObject



26
27
28
# File 'lib/moose_inventory/runtime_options.rb', line 26

def output_format
  format.to_s.downcase
end

#trace?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/moose_inventory/runtime_options.rb', line 22

def trace?
  @trace
end