Class: CaptainHoog::Hoogfile

Inherits:
Struct
  • Object
show all
Defined in:
lib/captain_hoog/hoogfile.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Struct

#fetch, #method_missing, #respond_to_missing?

Constructor Details

#initialize(path) ⇒ Hoogfile

Returns a new instance of Hoogfile.



12
13
14
15
# File 'lib/captain_hoog/hoogfile.rb', line 12

def initialize(path)
  @path = path
  super(hoogfile)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class CaptainHoog::Struct

Class Method Details

.read(path) ⇒ Object



4
5
6
# File 'lib/captain_hoog/hoogfile.rb', line 4

def self.read(path)
  self.send(:new,path)
end

Instance Method Details

#plugins_configObject Also known as: plugins_env



17
18
19
20
21
22
23
24
25
# File 'lib/captain_hoog/hoogfile.rb', line 17

def plugins_config
  # select all plugin config into an env hash
  config = self.to_h.reduce({}) do |plugins_env_hash, (item_key, item_value)|
    unless reserved_keys.include?(item_key)
      plugins_env_hash.update(item_key => item_value)
    end
  end
  CaptainHoog::Struct.new(config)
end