Method: Soup::Backends::YAMLBackend#save_snip
- Defined in:
- lib/soup/backends/yaml_backend.rb
#save_snip(attributes) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/soup/backends/yaml_backend.rb', line 35 def save_snip(attributes) File.open(path_for(attributes[:name]), 'w') do |f| attributes_without_content = attributes.dup f.write attributes_without_content.delete(:content) f.write attributes_without_content.to_yaml.gsub(/^---\s/, ATTRIBUTE_TOKEN + "\n") if attributes_without_content.any? end Snip.new(attributes, self) end |