Sha256: 53417c9627ef9cb152de99ddc2c891202c243f25a1bd87a496b82ffff52d9dd1

Contents?: true

Size: 679 Bytes

Versions: 2

Compression:

Stored size: 679 Bytes

Contents

require 'site_hook/paths'
require 'recursive_open_struct'

module SiteHook
  class Config
    class Get
      attr_reader :raw_config, :parsed_config, :config
      def initialize(cfg_path = Pathname.new(SiteHook::Paths.config || SiteHook::Paths.old_config))
        @filename = cfg_path
        @raw_config = YAML.load_file(cfg_path)
        @parsed_config = RecursiveOpenStruct.new(@raw_config, recurse_over_arrays: true, preserve_original_keys: true)
        @config = @parsed_config
      end

    end
    class Set
      attr_reader :filename
      def initialize(cfg_path)
        @filename = cfg_path
        @config = YAML.load_file(@filename)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
site_hook-0.8.2 lib/site_hook/config.rb
site_hook-0.8.1 lib/site_hook/config.rb