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.76 lib/docman/config.rb
docman-0.0.75 lib/docman/config.rb
docman-0.0.74 lib/docman/config.rb
docman-0.0.73 lib/docman/config.rb
docman-0.0.72 lib/docman/config.rb
docman-0.0.71 lib/docman/config.rb
docman-0.0.70 lib/docman/config.rb
docman-0.0.69 lib/docman/config.rb
docman-0.0.68 lib/docman/config.rb
docman-0.0.67 lib/docman/config.rb
docman-0.0.66 lib/docman/config.rb
docman-0.0.65 lib/docman/config.rb
docman-0.0.64 lib/docman/config.rb
docman-0.0.63 lib/docman/config.rb
docman-0.0.62 lib/docman/config.rb
docman-0.0.61 lib/docman/config.rb
docman-0.0.60 lib/docman/config.rb
docman-0.0.59 lib/docman/config.rb
docman-0.0.58 lib/docman/config.rb
docman-0.0.57 lib/docman/config.rb