flavors 0.2.0 → 0.3.0

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/README.md CHANGED
@@ -16,6 +16,11 @@ Or install it yourself as:
16
16
 
17
17
  $ gem install flavors
18
18
 
19
+ Generate the migration for the preferences table and migrate the database:
20
+
21
+ $ rails generate flavors:migration
22
+ $ rake db:migrate
23
+
19
24
  ## Usage
20
25
 
21
26
  To add preferences to your ActiveRecord model, in your model file:
@@ -12,6 +12,10 @@ module Flavors
12
12
  read_preference(name, options[:default])
13
13
  end
14
14
 
15
+ define_method("#{name}?") do
16
+ read_preference(name, options[:default])
17
+ end
18
+
15
19
  define_method("#{name}=") do |value|
16
20
  write_preference(name, value)
17
21
  callback.call(self, value) if callback
@@ -1,3 +1,3 @@
1
1
  module Flavors
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -57,4 +57,11 @@ describe Flavors::Preferences do
57
57
  subject.should_receive(:buz)
58
58
  subject.bar = true
59
59
  end
60
+
61
+ it "should respond to the preference name with question mark" do
62
+ subject.should respond_to(:notification?)
63
+ subject.notification?.should == true
64
+ subject.notification = false
65
+ subject.notification?.should == false
66
+ end
60
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flavors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-02-21 00:00:00.000000000 Z
13
+ date: 2013-03-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties
@@ -165,7 +165,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
165
  version: '0'
166
166
  segments:
167
167
  - 0
168
- hash: -1685997534619687224
168
+ hash: -172098477842830363
169
169
  required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  none: false
171
171
  requirements:
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
174
  version: '0'
175
175
  segments:
176
176
  - 0
177
- hash: -1685997534619687224
177
+ hash: -172098477842830363
178
178
  requirements: []
179
179
  rubyforge_project:
180
180
  rubygems_version: 1.8.23