Module: YmlReader

Defined in:
lib/yml_reader.rb,
lib/yml_reader/version.rb

Constant Summary collapse

VERSION =
"0.5"

Instance Method Summary collapse

Instance Method Details

#load(filename) ⇒ Object

Loads the requested file. It will look for the file in the directory specified by a call to the yml_directory= method.



27
28
29
# File 'lib/yml_reader.rb', line 27

def load(filename)
  @yml = ::YAML.load(ERB.new(File.read("#{yml_directory}/#{filename}")).result)
end

#yml_directoryObject

Returns the directory to be used when reading yml files



17
18
19
20
21
# File 'lib/yml_reader.rb', line 17

def yml_directory
  return @yml_directory if @yml_directory
  return default_directory if self.respond_to? :default_directory
  nil
end

#yml_directory=(directory) ⇒ Object

Set the directory to use when reading yml files



10
11
12
# File 'lib/yml_reader.rb', line 10

def yml_directory=(directory)
  @yml_directory = directory
end