Sha256: c5558ef134ee193a345c456a1ecdfea0b63b17bfb4cc30f13af3c9d01acdd243

Contents?: true

Size: 454 Bytes

Versions: 6

Compression:

Stored size: 454 Bytes

Contents

require 'yaml'
require 'magicspec/errors'
require 'ostruct'

module Magicspec
	class Config
		attr_reader :hash_content, :content
		
		def initialize filepath
			@f ||= filepath if valid?(filepath)
			File.open(@f) {|handle| @hash_content = YAML.load(handle)}
			@content = OpenStruct.new(@hash_content)
		end
		
		def valid?(filepath)
			raise ConfigFileMissingError unless File.exists?(filepath)
			true
		end

	end
end #Magicspec

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
magicspec-0.0.6 lib/magicspec/magicspec_config.rb
magicspec-0.0.5 lib/magicspec/magicspec_config.rb
magicspec-0.0.4 lib/magicspec/magicspec_config.rb
magicspec-0.0.3 lib/magicspec/magicspec_config.rb
magicspec-0.0.2 lib/magicspec/magicspec_config.rb
magicspec-0.0.1 lib/magicspec/magicspec_config.rb