Class AppConfig::Storage::YAML
In: lib/app_config/storage/yaml.rb
Parent: Storage::Base

YAML storage method.

Methods

[]   []=   empty?   new  

Constants

DEFAULT_PATH = File.expand_path(File.join(ENV['HOME'], '.app_config.yml'))

Public Class methods

Loads `@data` with the YAML file located at `path`. `@data` will be the Hashish that is accessed with `AppConfig[:key]`.

Defaults to `$HOME/.app_config.yml`

[Source]

# File lib/app_config/storage/yaml.rb, line 15
      def initialize(path = DEFAULT_PATH)
        # Make sure to use the top-level YAML module here.
        @data = Hashish.new(::YAML.load_file(path))
      end

Public Instance methods

[Source]

# File lib/app_config/storage/yaml.rb, line 20
      def [](key)
        @data[key]
      end

[Source]

# File lib/app_config/storage/yaml.rb, line 24
      def []=(key, value)
        @data[key] = value
      end

[Source]

# File lib/app_config/storage/yaml.rb, line 28
      def empty?
        @data.empty?
      end

[Validate]