Sha256: 948f24fc0cab1b74b21b8f5f3b740ee4e6a1647cd4509de2eb1ce23fa621af70

Contents?: true

Size: 535 Bytes

Versions: 10

Compression:

Stored size: 535 Bytes

Contents

module SsmConfig
  module SsmStorage
    class Yml
      CONFIG_PATH = 'config'.freeze
      def initialize(file_name)
        @file_name = file_name
      end

      def file_exists?
        File.exist?(file_path)
      end

      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

      private

      def file_path
        Rails.root.join(CONFIG_PATH, "#{@file_name}.yml")
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ssm_config-1.3.4 lib/ssm_config/ssm_storage/yml.rb
ssm_config-1.3.3 lib/ssm_config/ssm_storage/yml.rb
ssm_config-1.3.2 lib/ssm_config/ssm_storage/yml.rb
ssm_config-1.3.1 lib/ssm_config/ssm_storage/yml.rb
ssm_config-1.3.0 lib/ssm_config/ssm_storage/yml.rb
ssm_config-1.2.3 lib/ssm_config/ssm_storage/yml.rb
ssm_config-1.2.2 lib/ssm_config/ssm_storage/yml.rb
ssm_config-1.2.1 lib/ssm_config/ssm_storage/yml.rb
ssm_config-1.2.0 lib/ssm_config/ssm_storage/yml.rb
ssm_config-1.1.0 lib/ssm_config/ssm_storage/yml.rb