Class: Taketo::Actions::BaseAction

Inherits:
Object
  • Object
show all
Defined in:
lib/taketo/actions/base_action.rb

Direct Known Subclasses

EditConfig, GenerateSshConfig, List, Login, Matches, View

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ BaseAction

Returns a new instance of BaseAction.



10
11
12
13
# File 'lib/taketo/actions/base_action.rb', line 10

def initialize(options)
  @options          = options
  @destination_path = options[:destination_path]
end

Instance Attribute Details

#destination_pathObject (readonly)

Returns the value of attribute destination_path.



8
9
10
# File 'lib/taketo/actions/base_action.rb', line 8

def destination_path
  @destination_path
end

#optionsObject (readonly)

Returns the value of attribute options.



8
9
10
# File 'lib/taketo/actions/base_action.rb', line 8

def options
  @options
end

Instance Method Details

#configObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/taketo/actions/base_action.rb', line 15

def config
  @config ||= begin
    config_file = options[:config]

    DSL.new.configure(config_file).tap do |config|
      traverser = ConfigTraverser.new(config)
      ConfigValidator.new(traverser).validate!
    end
  end
end