active_null_object 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 416047c91750fa6f3bd95e5548117a8c74f5433d
4
- data.tar.gz: 2c610ebd2dba28cc7528fa2b83f5076967dd8211
3
+ metadata.gz: df250c8f885aa2477056a8b38f5a7c6b5aa3f9b2
4
+ data.tar.gz: f374b3854f95573d4dc80b1fc9a9c6db8e965279
5
5
  SHA512:
6
- metadata.gz: 0fa20c14aea6ee14f879ea6dc75cc3b8185425cd8566da060a26eaa7c41a5bbdf394d78e6f2ecf64d1423871d13004ca3de34473898c67bed2f654080c14ca3e
7
- data.tar.gz: 4e7d7958c23a6842c087f135cfb05b883c9f47643663cbe309277597ece98510e66ace0803c0699ba773d2b1580106b01ef0d933f5fa55681f3b97b405ad4af1
6
+ metadata.gz: 7b42aaf752802243a6025122516de4a4e5099bb59d5f99e70807b85fcebeb549c30cfbc4f85ea08f705bad85ece2e27f19f09cd5da8304c3d5e1eef0ff62c2a0
7
+ data.tar.gz: 7b5fb5f4bb01c3a7bb2b2ef2849c87a02bab4f57e94f9f361cbb6e3aada693c21623dd796718bb9cca54e61264afa9d405b8aefc47ccca94f4d911a749dc1e51
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -23,7 +23,7 @@ module ActiveNullObject
23
23
  "Null#{name.to_s.classify}"
24
24
  end
25
25
  define_method(name) do
26
- super() || null_object.constantize.new
26
+ super() || null_object.constantize.public_send(ActiveNullObject.initialize_method)
27
27
  end
28
28
  end
29
29
  end
@@ -4,7 +4,7 @@ module ActiveNullObject
4
4
 
5
5
  module ClassMethods
6
6
  def find_or_null_object(id)
7
- find_by(id: id) || "Null#{name}".constantize.new
7
+ find_by(id: id) || "Null#{name}".constantize.public_send(ActiveNullObject.initialize_method)
8
8
  end
9
9
  end
10
10
  end
@@ -1,9 +1,12 @@
1
1
  require 'active_record'
2
2
  require 'active_support'
3
+ require 'active_support/core_ext/module/attribute_accessors'
3
4
  require 'active_null_object/association'
4
5
  require 'active_null_object/finder'
5
6
 
6
7
  module ActiveNullObject
8
+ mattr_accessor :initialize_method
9
+ self.initialize_method = "new"
7
10
  end
8
11
 
9
12
  ActiveRecord::Base.send(:include, ActiveNullObject::Association)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_null_object
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Roex
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-17 00:00:00.000000000 Z
11
+ date: 2014-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord