Module: YamlPath

Defined in:
lib/yaml_path.rb,
lib/yaml_path/version.rb,
lib/yaml_path/tree_builder.rb

Defined Under Namespace

Classes: Error, PathStack, TreeBuilder

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.replace(yaml_content, yaml_path, &block) ⇒ Object



9
10
11
# File 'lib/yaml_path.rb', line 9

def replace(yaml_content, yaml_path, &block)
  YAML::Parser.new(TreeBuilder.new(yaml_path: yaml_path, replace_proc: block)).parse(yaml_content).handler.root.to_yaml
end