sinatra-tinycache 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/sinatra/tinycache.rb +5 -2
  2. metadata +10 -21
@@ -1,4 +1,5 @@
1
1
  require 'active_support/core_ext'
2
+ require 'digest/sha1'
2
3
 
3
4
  module Sinatra
4
5
  module TinyCache
@@ -10,7 +11,7 @@ module Sinatra
10
11
  def cache_data(key, data)
11
12
  location = cache_path(key.to_s)
12
13
  File.open(location, 'w') do |f|
13
- f.puts data
14
+ f.write data
14
15
  end
15
16
  end
16
17
 
@@ -26,7 +27,9 @@ module Sinatra
26
27
  end
27
28
 
28
29
  def cache_age(key)
29
- (Time.now - File.ctime(cache_path(key))).to_i
30
+ location = cache_path(key.to_s)
31
+ return nil if !File.exist?(location)
32
+ (Time.now - File.ctime(location)).to_i
30
33
  end
31
34
  end
32
35
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ben Sales
@@ -14,30 +14,18 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-26 00:00:00 +01:00
17
+ date: 2010-06-30 00:00:00 +01:00
18
18
  default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: activesupport
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ~>
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 2
29
- - 3
30
- version: "2.3"
31
- type: :runtime
32
- version_requirements: *id001
19
+ dependencies: []
20
+
33
21
  description:
34
22
  email: ben@twoism.co.uk
35
23
  executables: []
36
24
 
37
25
  extensions: []
38
26
 
39
- extra_rdoc_files: []
40
-
27
+ extra_rdoc_files:
28
+ - README.markdown
41
29
  files:
42
30
  - README.markdown
43
31
  - lib/sinatra/tinycache.rb
@@ -46,8 +34,9 @@ homepage: http://code.twoism.co.uk
46
34
  licenses: []
47
35
 
48
36
  post_install_message:
49
- rdoc_options: []
50
-
37
+ rdoc_options:
38
+ - --main
39
+ - README.markdown
51
40
  require_paths:
52
41
  - lib
53
42
  required_ruby_version: !ruby/object:Gem::Requirement