Method: Glyph::Config#initialize

Defined in:
lib/glyph/config.rb

#initialize(options = {}) ⇒ Config

Initializes the configuration with a hash of options:

  • :file (default: nil) - A YAML file to read data from

  • :data (default: {})- The initial contents

  • :resettable (default: false) - Whether the configuration can be reset (cleared) or not

  • :mutable (default: true) - Whether the configuration can be changed or not

Parameters:

  • options (Hash) (defaults to: {})

    the configuration options (merged with the the defaults)



18
19
20
21
22
23
24
# File 'lib/glyph/config.rb', line 18

def initialize(options={})
  default_options = {:file => nil, :data => {}, :resettable => false, :mutable => true}
  @options = default_options.merge options
  @file = @options[:file]
  @data = @options[:data]
  read if @file
end