Method: Pathname#read_yaml
- Defined in:
- lib/pleasant_path/yaml/pathname.rb
#read_yaml ⇒ nil, ...
Reads the file indicated by the Pathname, and parses the contents as YAML. The returned result will be composed of only basic data types, e.g. nil
, true
, false
, Numeric
, String
, Array
, and Hash
.
16 17 18 |
# File 'lib/pleasant_path/yaml/pathname.rb', line 16 def read_yaml self.open("r"){|f| YAML.safe_load(f, filename: self) } end |