cereal_box 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cereal_box (0.0.1)
4
+ cereal_box (0.0.2)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/README.rdoc CHANGED
@@ -10,12 +10,12 @@ Ever have a controller that looks like this?
10
10
  respond_to :json
11
11
 
12
12
  def show
13
- @thing = Thing.find(1)
14
- @thing = @thing.as_json
15
- @thing[:other_things][:name] = thing.other_thing.name
16
- @thing[:other_related_thing][:name] = thing.other_related_thing.name
13
+ @thing = Thing.find(params[:id])
14
+ @thing_json = @thing.as_json
15
+ @thing_json[:other_things][:name] = @thing.other_thing.name
16
+ @thing_json[:other_related_thing][:name] = @thing.other_related_thing.name
17
17
 
18
- respond_with(@thing)
18
+ respond_with(@thing_json)
19
19
  end
20
20
  end
21
21
 
@@ -1,3 +1,3 @@
1
1
  module CerealBox
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/cereal_box.rb CHANGED
@@ -2,9 +2,9 @@ require "cereal_box/version"
2
2
 
3
3
  module CerealBox
4
4
 
5
- def self.included?(base)
6
- base.attr_accessor :cereal_box_base_instance
7
- base.attr_accessor :cereal_box_previous_filter
5
+ def self.included(base)
6
+ base.send(:attr_accessor, :cereal_box_base_instance)
7
+ base.send(:attr_accessor, :cereal_box_previous_filter)
8
8
  end
9
9
 
10
10
  def initialize(base)
@@ -34,6 +34,20 @@ class SecondAdditiveFilter
34
34
  end
35
35
  end
36
36
 
37
+ class Basket
38
+ def as_json(options = {})
39
+ {}
40
+ end
41
+ end
42
+
43
+ class LotionFilter
44
+ include CerealBox
45
+
46
+ def attributes(base)
47
+ { :lotion => true }
48
+ end
49
+ end
50
+
37
51
  describe CerealBox do
38
52
 
39
53
  describe 'with the base class' do
@@ -116,4 +130,12 @@ describe CerealBox do
116
130
  end
117
131
  end
118
132
 
133
+ describe 'with a basket and some lotion' do
134
+ subject { LotionFilter.new(Basket.new) }
135
+
136
+ it 'puts the lotion in the basket' do
137
+ subject.as_json[:lotion].should include :lotion
138
+ end
139
+ end
140
+
119
141
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cereal_box
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-13 00:00:00.000000000 -04:00
12
+ date: 2011-10-14 00:00:00.000000000 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
17
- requirement: &18087140 !ruby/object:Gem::Requirement
17
+ requirement: &6370200 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *18087140
25
+ version_requirements: *6370200
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
- requirement: &18086120 !ruby/object:Gem::Requirement
28
+ requirement: &6369340 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *18086120
36
+ version_requirements: *6369340
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: guard
39
- requirement: &18084760 !ruby/object:Gem::Requirement
39
+ requirement: &6367500 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *18084760
47
+ version_requirements: *6367500
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: guard-rspec
50
- requirement: &18082860 !ruby/object:Gem::Requirement
50
+ requirement: &6366120 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *18082860
58
+ version_requirements: *6366120
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rake
61
- requirement: &18050160 !ruby/object:Gem::Requirement
61
+ requirement: &6333280 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,7 +66,7 @@ dependencies:
66
66
  version: '0'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *18050160
69
+ version_requirements: *6333280
70
70
  description: Serialization filters for active record.
71
71
  email:
72
72
  - christopher.meiklejohn@gmail.com
@@ -104,7 +104,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  segments:
106
106
  - 0
107
- hash: 2025275564822566330
107
+ hash: -3517514527611502111
108
108
  required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  none: false
110
110
  requirements:
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  version: '0'
114
114
  segments:
115
115
  - 0
116
- hash: 2025275564822566330
116
+ hash: -3517514527611502111
117
117
  requirements: []
118
118
  rubyforge_project: cereal_box
119
119
  rubygems_version: 1.6.2