action_tracker 0.1.6.1 → 0.1.6.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: 95b7ca602ff277335a2acd905ff32982da8cbc32
4
- data.tar.gz: ecc497a6c1971d77020742d6dfdaab93bbc4184a
3
+ metadata.gz: 17a7ac82929250a9c782575614ce3a6b72630646
4
+ data.tar.gz: bc7d46f483cf87562d7a2267b9ca04327a0bc6bd
5
5
  SHA512:
6
- metadata.gz: 6148bb626827580561c80a28173a70da1280083e60b543db0a34d555cf49e07756f1e575a990588396f6b80ae8aaca587b35016df1c81811a6e2a7b6f279074b
7
- data.tar.gz: af243db1092db04aea9800297987f1c15dfded645a88c9bc1c32f076887db2835f5e15567f4393f12cc1bcdf526fbbb37bbe621bdb11cc6f823c4802d8f4289a
6
+ metadata.gz: ba376cb1d6f7a7f443c7900b3c98bd0b47f8d184622de9d7f00559eae108bc9f9164b7d2801801f9d8f15822d7422b8bf6d7ab6bc11e9424b98806f3d826bde4
7
+ data.tar.gz: b1d005029241f7a145e780a2299b7b9c0edf07dd320f7bb765e7ec2978ac0ae8bf3fb805d8fbf1fe40b39df6b19d79c37bff04e37b90e83070ac6951c895330f
@@ -53,7 +53,7 @@ module ActionTracker
53
53
  def find_resource
54
54
  @resource_method ||= Devise.mappings.keys.map { |resource| "current_#{resource}" }
55
55
  .select { |method_name| !method(method_name).call.nil? }
56
- .first
56
+ .first || 'nil_current_resource'
57
57
  rescue NameError
58
58
  nil
59
59
  end
@@ -75,6 +75,10 @@ module ActionTracker
75
75
  def namespace
76
76
  self.class.name.deconstantize.try(:+, '::')
77
77
  end
78
+
79
+ def nil_current_resource
80
+ NilResource.new
81
+ end
78
82
  end
79
83
  end
80
84
  end
@@ -0,0 +1,36 @@
1
+ module ActionTracker
2
+ # nodoc
3
+ class NilResource
4
+ def method_missing(_name, *_args)
5
+ self
6
+ end
7
+
8
+ def respond_to_missing?(*_args)
9
+ true
10
+ end
11
+
12
+ def to_s
13
+ ''
14
+ end
15
+
16
+ def to_a
17
+ []
18
+ end
19
+
20
+ def to_str
21
+ to_s
22
+ end
23
+
24
+ def to_ary
25
+ to_a
26
+ end
27
+
28
+ def to_i
29
+ 0
30
+ end
31
+
32
+ def present?
33
+ true
34
+ end
35
+ end
36
+ end
@@ -1,3 +1,3 @@
1
1
  module ActionTracker
2
- VERSION = '0.1.6.1'.freeze
2
+ VERSION = '0.1.6.2'.freeze
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require 'action_tracker/version'
2
+ require 'action_tracker/nil_resource'
2
3
  require 'action_tracker/concerns/tracker'
3
4
  require 'action_tracker/helpers/render'
4
5
  require 'action_tracker/base'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_tracker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6.1
4
+ version: 0.1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Taiar
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-05-10 00:00:00.000000000 Z
12
+ date: 2016-05-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -182,6 +182,7 @@ files:
182
182
  - lib/action_tracker/matchers.rb
183
183
  - lib/action_tracker/matchers/have_action_tracker_matcher.rb
184
184
  - lib/action_tracker/matchers/track_matcher.rb
185
+ - lib/action_tracker/nil_resource.rb
185
186
  - lib/action_tracker/version.rb
186
187
  homepage: http://coders.appprova.com.br/
187
188
  licenses: