Module: Ryo::YAML
Overview
Instance Method Summary collapse
-
#from_yaml(path: nil, string: nil, object: Ryo::Object) ⇒ Ryo::Object, Ryo::BasicObject
Returns a Ryo object.
Instance Method Details
#from_yaml(path: nil, string: nil, object: Ryo::Object) ⇒ Ryo::Object, Ryo::BasicObject
Returns a Ryo object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ryo/yaml.rb', line 32 def from_yaml(path: nil, string: nil, object: Ryo::Object) if path && string raise ArgumentError, "Provide a path or string but not both" elsif path object.from YAML.load_file(path) elsif string object.from YAML.load(string) else raise ArgumentError, "No path or string provided" end end |