redis_snippets 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -19,10 +19,10 @@ end
19
19
 
20
20
  desc "New release"
21
21
  task :new_release do |t|
22
- `rake version:bump:patch` # Updates VERSION.
23
- `rake gemspec`
24
- `git commit -am "Preparing new release."`
25
- `rm -f pkg/*`
26
- `rake build`
22
+ # `rake version:bump:patch` # Updates VERSION.
23
+ # `rake gemspec`
24
+ # `git commit -am "Preparing new release."`
25
+ # `rm -f pkg/*`
26
+ # `rake build`
27
27
  `rake rubygems:release`
28
28
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -1,10 +1,29 @@
1
1
  module RedisSnippets
2
2
  module SnippetsHelper
3
- def snippet(advert, classes=nil)
3
+ def snippet_content(snippet_name)
4
+ RedisSnippets::Snippets.send(snippet_name)
5
+ end
6
+
7
+ # Return true if snippet has content.
8
+ def snippet_has_content?(snippet_name)
9
+ !RedisSnippets::Snippets.send(snippet_name).blank?
10
+ end
11
+
12
+ def snippet(snippet_name, classes=nil)
4
13
  return '' if controller.status == 404
5
- ad_html = RedisSnippets::Snippets.send(advert)
6
- return '' if ad_html.blank?
7
- content_tag(:div, ad_html.html_safe, :class => ['advert', classes || advert.to_s].compact.join(' ').html_safe)
14
+ content = snippet_content(snippet_name)
15
+ return '' if content.blank?
16
+ build_snippet(content, snippet_class_list(snippet_name, classes))
17
+ end
18
+
19
+ def snippet_class_list(snippet_name, classes)
20
+ ['snippet', classes || snippet_name.to_s].compact.join(' ').html_safe
21
+ end
22
+
23
+ def build_snippet(content, classes)
24
+ content_tag(:div,
25
+ content.html_safe,
26
+ :class => classes)
8
27
  end
9
28
  end
10
29
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{redis_snippets}
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Martin Moen Wulffeld"]
12
- s.date = %q{2011-04-30}
12
+ s.date = %q{2011-05-24}
13
13
  s.description = %q{}
14
14
  s.email = %q{martin@wulffeld.org}
15
15
  s.extra_rdoc_files = [
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
30
30
  "redis_snippets.gemspec"
31
31
  ]
32
32
  s.require_paths = ["lib"]
33
- s.rubygems_version = %q{1.5.0}
33
+ s.rubygems_version = %q{1.7.2}
34
34
  s.summary = %q{View snippets held in Redis storage.}
35
35
 
36
36
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis_snippets
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Martin Moen Wulffeld
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-30 00:00:00 +02:00
19
- default_executable:
18
+ date: 2011-05-24 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: redis
@@ -67,7 +66,6 @@ files:
67
66
  - lib/redis_snippets/railtie.rb
68
67
  - lib/redis_snippets/redis.rb
69
68
  - redis_snippets.gemspec
70
- has_rdoc: true
71
69
  homepage:
72
70
  licenses: []
73
71
 
@@ -97,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
95
  requirements: []
98
96
 
99
97
  rubyforge_project:
100
- rubygems_version: 1.5.0
98
+ rubygems_version: 1.7.2
101
99
  signing_key:
102
100
  specification_version: 3
103
101
  summary: View snippets held in Redis storage.