Module: UsingYAML::InstanceMethods
- Defined in:
- lib/using_yaml.rb
Overview
Instance methods which allow us to define where YAML files are read/written from/to.
Instance Method Summary collapse
-
#using_yaml_path ⇒ Object
Reader which determines where to find files according to the following recipe:.
-
#using_yaml_path=(path) ⇒ Object
Sets the YAML load path to the given argument by invoking
Pathname.new
onpath
.
Instance Method Details
#using_yaml_path ⇒ Object
Reader which determines where to find files according to the following recipe:
(1) Load the :path option from +using_yaml+, if set
(2) Possibly invoke a Proc (if supplied to step 1)
(3) Default to the current location if 1 & 2 failed
You can, of course, overrite this method if you wish to supply your own logic.
187 188 189 190 191 192 193 |
# File 'lib/using_yaml.rb', line 187 def using_yaml_path return @using_yaml_path unless @using_yaml_path.nil? path = UsingYAML.path(self.class.name) path = path.call(self) if path.is_a? Proc @using_yaml_path = Pathname.new(path || '.') end |
#using_yaml_path=(path) ⇒ Object
Sets the YAML load path to the given argument by invoking Pathname.new
on path
.
197 198 199 |
# File 'lib/using_yaml.rb', line 197 def using_yaml_path=(path) @using_yaml_path = path && Pathname.new(path) end |