Sha256: 1672cac1bc2b2d4dcc83b298dabcbee07d79c4de6f45e8060f8b88de6bc0bf7c

Contents?: true

Size: 530 Bytes

Versions: 7

Compression:

Stored size: 530 Bytes

Contents

require "yaml_properties/version"
require "active_support/core_ext/hash"

module YamlProperties
  def properties
    @properties ||= load_properties.with_indifferent_access
  end

  def reset_properties
    @properties = nil
  end

  def method_missing(key, *args, &block)
    return properties[key] if properties.keys.include? key.to_s

    super key, *args, &block
  end

  private

  def yaml_file
    File.join %w(config properties.yml)
  end

  def load_properties
    YAML.load File.open(yaml_file)
  end

  extend self
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
yaml_properties-0.0.7 lib/yaml_properties.rb
yaml_properties-0.0.6 lib/yaml_properties.rb
yaml_properties-0.0.5 lib/yaml_properties.rb
yaml_properties-0.0.4 lib/yaml_properties.rb
yaml_properties-0.0.3 lib/yaml_properties.rb
yaml_properties-0.0.2 lib/yaml_properties.rb
yaml_properties-0.0.1 lib/yaml_properties.rb