attr_cleaner 0.0.4 → 0.1.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/.gitignore CHANGED
@@ -2,4 +2,4 @@ pkg/*
2
2
  .yardoc/*
3
3
  *.gem
4
4
  .bundle
5
- /.redcar/tags
5
+ .redcar/*
data/attr_cleaner.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.email = ["thomas@pixent.com.au"]
11
11
  s.homepage = "https://rubygems.org/gems/attr_cleaner"
12
12
  s.summary = "Cleans up model attributes."
13
- s.description = "Strips spaces from attributes, and sets empty strings to nil."
13
+ s.description = "Strips spaces from attributes, and sets empty strings to nil. Can be used with Rails 3, in any ActiveRecord project, or with other ORMs that define write_attribute."
14
14
 
15
15
  s.files = `git ls-files`.split("\n")
16
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -18,5 +18,4 @@ Gem::Specification.new do |s|
18
18
  s.require_paths = ["lib"]
19
19
 
20
20
  s.add_dependency('activesupport', '~> 3.0.0')
21
- s.add_dependency('activerecord', '~> 3.0.0')
22
21
  end
data/lib/attr_cleaner.rb CHANGED
@@ -1,10 +1,15 @@
1
1
  require "active_support"
2
- require "active_record"
3
-
4
2
  require "active_support/core_ext/module/aliasing"
5
3
  require "active_support/concern"
6
4
 
7
- # If not using active_record require attr_cleaner/module_mixin
8
- # and include it into your own ORM.
9
5
  require "attr_cleaner/module_mixin"
10
- ActiveRecord::Base.send(:include, AttrCleaner::ModuleMixin)
6
+
7
+ # If not using active_record then include AttrCleaner::ModuleMixin.
8
+
9
+ if defined?(Rails::Railtie)
10
+ # Railtie is used to ensure correct loading order
11
+ require "attr_cleaner/railtie"
12
+ else
13
+ # If used outside of rails, just check for ActiveRecord::Base
14
+ ActiveRecord::Base.send(:include, AttrCleaner::ModuleMixin) if defined?(ActiveRecord::Base)
15
+ end
@@ -1,3 +1,3 @@
1
1
  module AttrCleaner
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
+ - 1
7
8
  - 0
8
- - 4
9
- version: 0.0.4
9
+ version: 0.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Thomas Drake-Brockman
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-31 00:00:00 +08:00
17
+ date: 2011-01-01 00:00:00 +08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -32,22 +32,7 @@ dependencies:
32
32
  version: 3.0.0
33
33
  type: :runtime
34
34
  version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: activerecord
37
- prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ~>
42
- - !ruby/object:Gem::Version
43
- segments:
44
- - 3
45
- - 0
46
- - 0
47
- version: 3.0.0
48
- type: :runtime
49
- version_requirements: *id002
50
- description: Strips spaces from attributes, and sets empty strings to nil.
35
+ description: Strips spaces from attributes, and sets empty strings to nil. Can be used with Rails 3, in any ActiveRecord project, or with other ORMs that define write_attribute.
51
36
  email:
52
37
  - thomas@pixent.com.au
53
38
  executables: []