soup 1.0.13 → 1.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2cdde42bcba5e8941e39c5357151f663583dcf5
4
- data.tar.gz: 25aad47ac91728b5185dfa5ea44e1afdd1df58d0
3
+ metadata.gz: 18fe77d82b9d4f4b75d02b84e763dd0734a5e88d
4
+ data.tar.gz: 2a5615ee341ac63134c9bf1c8e697592fda14707
5
5
  SHA512:
6
- metadata.gz: 559c0a7caba3609db903f53e58e803049ad2a52f34ac6f2a268ca0ee7735c29bd07f7e88ef1bfd0e1f153cc0a5d169f2a35c2b0543cdcd9226c9d999c08be5fb
7
- data.tar.gz: b080481909c140e1795ba68206d8fe04604a65ed34416cb382b9d7c3f23e50c9d7274ece2523da778c321e715cad209102a2aab482989b1602abd6125d05a1f4
6
+ metadata.gz: e13bb835c158734560ef3906335a6c4fcafaaf2941a6e7742d689918aa24e13d9ceb2945a1dea40781e9c082b1fb6b81c5824423319c78b270987ac6c84a06aa
7
+ data.tar.gz: bdaea59a78bd3534e5c9c243baf9649ee6a996e67497cb978ed0134f37f90dc70b0a00c016ecf9a4568e341c697fa41105f11f3ce0d9c91e3833958aaa425efa
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 = "1.0.13"
24
+ s.version = "1.0.14"
25
25
  s.summary = "A super-simple data store"
26
26
  s.author = "James Adam"
27
27
  s.email = "james@lazyatom.com"
@@ -54,20 +54,23 @@ class Soup
54
54
  end
55
55
 
56
56
  def load_snip_from_path(path, name)
57
- file = File.new(path)
58
- data = file.read
59
- default_attributes = {:name => name, :updated_at => file.mtime, :created_at => file.mtime}
60
- if attribute_start = data.index("\n:")
61
- content = data[0, attribute_start].strip
62
- attributes = default_attributes.merge(YAML.load(data[attribute_start, data.length]))
63
- else
64
- content = data
65
- attributes = default_attributes
57
+ snip = nil
58
+ File.open(path) do |file|
59
+ data = file.read
60
+ default_attributes = {:name => name, :updated_at => file.mtime, :created_at => file.mtime}
61
+ if attribute_start = data.index("\n:")
62
+ content = data[0, attribute_start].strip
63
+ attributes = default_attributes.merge(YAML.load(data[attribute_start, data.length]))
64
+ else
65
+ content = data
66
+ attributes = default_attributes
67
+ end
68
+ attributes.update(:content => content) if content && content.length > 0
69
+ extension = File.extname(path).gsub(/^\./, '')
70
+ attributes.update(:extension => extension) if extension != "snip"
71
+ snip = Snip.new(attributes, self)
66
72
  end
67
- attributes.update(:content => content) if content && content.length > 0
68
- extension = File.extname(path).gsub(/^\./, '')
69
- attributes.update(:extension => extension) if extension != "snip"
70
- Snip.new(attributes, self)
73
+ snip
71
74
  end
72
75
 
73
76
  def path_for(name, extension=nil)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.13
4
+ version: 1.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Adam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-05 00:00:00.000000000 Z
11
+ date: 2017-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kintama
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  version: '0'
87
87
  requirements: []
88
88
  rubyforge_project:
89
- rubygems_version: 2.5.1
89
+ rubygems_version: 2.5.2
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: A super-simple data store