Class: Magicspec::Config
- Inherits:
-
Object
- Object
- Magicspec::Config
- Defined in:
- lib/magicspec/magicspec_config.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#hash_content ⇒ Object
readonly
Returns the value of attribute hash_content.
Instance Method Summary collapse
-
#initialize(filepath) ⇒ Config
constructor
A new instance of Config.
- #valid?(filepath) ⇒ Boolean
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
#content ⇒ Object (readonly)
Returns the value of attribute content.
7 8 9 |
# File 'lib/magicspec/magicspec_config.rb', line 7 def content @content end |
#hash_content ⇒ Object (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
14 15 16 17 |
# File 'lib/magicspec/magicspec_config.rb', line 14 def valid?(filepath) raise ConfigFileMissingError unless File.exists?(filepath) true end |