Class: Magicspec::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/magicspec/magicspec_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filepath) ⇒ Config

Returns a new instance of Config.



9
10
11
12
# File 'lib/magicspec/magicspec_config.rb', line 9

def initialize filepath
	@f ||= filepath if valid?(filepath)
	File.open(@f) {|handle| @content = YAML.load(handle)}
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



7
8
9
# File 'lib/magicspec/magicspec_config.rb', line 7

def content
  @content
end

#hash_contentObject (readonly)

Returns the value of attribute hash_content.



7
8
9
# File 'lib/magicspec/magicspec_config.rb', line 7

def hash_content
  @hash_content
end

Instance Method Details

#valid?(filepath) ⇒ Boolean

Returns:

  • (Boolean)

Raises:



14
15
16
17
# File 'lib/magicspec/magicspec_config.rb', line 14

def valid?(filepath)
	raise ConfigFileMissingError unless File.exists?(filepath)
	true
end