Class: GhostAdapter::EnvParser

Inherits:
Object
  • Object
show all
Defined in:
lib/ghost_adapter/env_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env = {}) ⇒ EnvParser

Returns a new instance of EnvParser.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/ghost_adapter/env_parser.rb', line 5

def initialize(env = {})
  @config = env.map do |key, value|
    next unless ghost_key?(key)

    config_key = convert_env_key(key)

    next unless GhostAdapter::CONFIG_KEYS.include?(config_key)

    config_value = convert_env_value(value)

    [config_key, config_value]
  end.compact.to_h
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/ghost_adapter/env_parser.rb', line 3

def config
  @config
end