soup 0.9.11 → 0.9.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -21,7 +21,7 @@ spec = Gem::Specification.new do |s|
21
21
 
22
22
  # Change these as appropriate
23
23
  s.name = "soup"
24
- s.version = "0.9.11"
24
+ s.version = "0.9.12"
25
25
  s.summary = "A super-simple data store"
26
26
  s.author = "James Adam"
27
27
  s.email = "james@lazyatom.com"
@@ -45,9 +45,9 @@ class Soup
45
45
 
46
46
  def save_snip(attributes)
47
47
  File.open(path_for(attributes[:name]), 'w') do |f|
48
- content = attributes.delete(:content)
49
- f.write content
50
- f.write attributes.to_yaml.gsub(/^---\s/, ATTRIBUTE_TOKEN) if attributes.any?
48
+ attributes_without_content = attributes.dup
49
+ f.write attributes_without_content.delete(:content)
50
+ f.write attributes_without_content.to_yaml.gsub(/^---\s/, ATTRIBUTE_TOKEN) if attributes_without_content.any?
51
51
  end
52
52
  Snip.new(attributes, self)
53
53
  end
data/test/soup_test.rb CHANGED
@@ -27,6 +27,11 @@ class SoupTest < Test::Unit::TestCase
27
27
  assert_equal "I like stuff, and things", @soup['test'].content
28
28
  end
29
29
 
30
+ should "return a snip when storing content" do
31
+ snip = @soup << {:name => 'test', :content => "I like stuff, and things"}
32
+ assert_equal "I like stuff, and things", snip.content
33
+ end
34
+
30
35
  context "when sieving the soup" do
31
36
  setup do
32
37
  @james = @soup << {:name => 'james', :spirit_guide => 'fox', :colour => 'blue', :powers => 'yes'}
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 11
9
- version: 0.9.11
8
+ - 12
9
+ version: 0.9.12
10
10
  platform: ruby
11
11
  authors:
12
12
  - James Adam