Class: SsmConfig::SsmStorage::Yml

Inherits:
Object
  • Object
show all
Defined in:
lib/ssm_config/ssm_storage/yml.rb

Constant Summary collapse

CONFIG_PATH =
'config'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(file_name) ⇒ Yml

Returns a new instance of Yml.



5
6
7
# File 'lib/ssm_config/ssm_storage/yml.rb', line 5

def initialize(file_name)
  @file_name = file_name
end

Instance Method Details

#file_exists?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/ssm_config/ssm_storage/yml.rb', line 9

def file_exists?
  File.exist?(file_path)
end

#hashObject



13
14
15
16
# File 'lib/ssm_config/ssm_storage/yml.rb', line 13

def hash
  yaml_loaded = YAML.load(ERB.new(File.read((file_path).to_s)).result)
  (yaml_loaded[Rails.env] || yaml_loaded['any']).try(:with_indifferent_access)
end