scrubby 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/scrubby.rb +5 -1
  3. data/scrubby.gemspec +1 -1
  4. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -64,6 +64,10 @@ module Scrubby
64
64
  scrubber = block_given? ? block : instance_method(:scrub)
65
65
  self.scrubbers = attributes.inject({}){|s,a| s.merge!(a.to_s => scrubber) }
66
66
  end
67
+
68
+ def scrubby?
69
+ !scrubbers.blank?
70
+ end
67
71
  end
68
72
 
69
73
  module InstanceMethods
@@ -71,7 +75,7 @@ module Scrubby
71
75
  # scrubber exists for the given attribute and if so, scrub the given value before passing it
72
76
  # on to the original +write_attribute+ method.
73
77
  def write_attribute_with_scrub(attribute, value)
74
- if scrubber = scrubbers[attribute.to_s]
78
+ if self.class.scrubby? && scrubber = scrubbers[attribute.to_s]
75
79
  value = scrubber.bind(self).call(value)
76
80
  end
77
81
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{scrubby}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Steve Richert"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrubby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Richert