Sha256: fb51177717410257fb128c0881d592c4fa915328ef037514c7400dceaa4dc96b

Contents?: true

Size: 642 Bytes

Versions: 63

Compression:

Stored size: 642 Bytes

Contents

require 'singleton'
require 'hash_deep_merge'
require 'digest/md5'

module Docman
  class Config < Hash

    attr_reader :unmutable_config

    def initialize(file)
      super
      @config = YAML::load_file(file)
      assign_to_self
    end

    def assign_to_self
      @config.each_pair do |k, v|
        self[k] = v
      end
      @unmutable_config = Marshal::load(Marshal.dump(@config))
    end

    def merge_config_from_file(file)
      config = YAML::load_file(file)
      @config.deep_merge(config)
      assign_to_self
    end

    def config_hash
      Digest::MD5.hexdigest(Marshal::dump(@unmutable_config))
    end

  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
docman-0.0.36 lib/docman/config.rb
docman-0.0.35 lib/docman/config.rb
docman-0.0.34 lib/docman/config.rb
docman-0.0.33 lib/docman/config.rb
docman-0.0.32 lib/docman/config.rb
docman-0.0.31 lib/docman/config.rb
docman-0.0.30 lib/docman/config.rb
docman-0.0.29 lib/docman/config.rb
docman-0.0.28 lib/docman/config.rb
docman-0.0.27 lib/docman/config.rb
docman-0.0.26 lib/docman/config.rb
docman-0.0.25 lib/docman/config.rb
docman-0.0.24 lib/docman/config.rb
docman-0.0.23 lib/docman/config.rb
docman-0.0.22 lib/docman/config.rb
docman-0.0.21 lib/docman/config.rb
docman-0.0.20 lib/docman/config.rb
docman-0.0.19 lib/docman/config.rb
docman-0.0.18 lib/docman/config.rb
docman-0.0.17 lib/docman/config.rb