activefacts-api 1.9.2 → 1.9.4

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: d49215e86ffa0e5ff4c3c4245834dbe57bca2b69
4
- data.tar.gz: ffe190be92cd81ceef91f4204ef27d5f7fd0f414
3
+ metadata.gz: 36cc46a9af5dba1464033268c79c38e5c5e16747
4
+ data.tar.gz: 5561297083e7779574968c3bf395f509602c1f2c
5
5
  SHA512:
6
- metadata.gz: 9be5b953f3e71c05c1f7211ce09fb0c5e21f69b3c519ea58aeaa76323b29ddd82bbb5e3269328b55f41f1d1c75dfd74738a93e01ec4b21b55f1fe00303d992d0
7
- data.tar.gz: 769cc83b2198f25f2867a8104e8feaa4fa1b88e51df38a4766c5ba6fd802e1826d4fad47da3cfefec05cddd679417f4e51b885fc728a114d3be9f43d9b8a0241
6
+ metadata.gz: e4bab7cf55c08efb17d68ae45da684dc9daf7d13606ba236170bc7e82abb69b04576997f33287730fe082df097867859fa0442200ab71bec7ce74c330b0037c0
7
+ data.tar.gz: d9e52ec5cb6e4527c2c7c2cfd9f4f47476430a786d13deb74c211f1f3ed37edb02503860bc53e52a115a171a6538623c5b9cbf9babbede1bc40caf0a136edaef
@@ -32,7 +32,7 @@ over the fact population.
32
32
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
33
33
 
34
34
  spec.add_runtime_dependency 'rbtree-pure', [">= 0.1.1", "~> 0"]
35
- spec.add_runtime_dependency 'tracing', ["~> 2"]
35
+ spec.add_runtime_dependency 'tracing', ["~> 2", ">= 2.0.4"]
36
36
 
37
37
  spec.add_development_dependency "bundler", ">= 1.10", "~> 1.10.6"
38
38
  spec.add_development_dependency "rake", "~> 10.0"
@@ -255,7 +255,7 @@ module ActiveFacts
255
255
  end
256
256
  value = attrs[role_name]
257
257
  else
258
- value = attrs[role_name] || instance.send(role.getter)
258
+ value = attrs.include?(role_name) ? attrs[role_name] : instance.send(role.getter)
259
259
  end
260
260
  hash[role_name] = value if value != nil
261
261
  hash
@@ -78,9 +78,9 @@ module ActiveFacts
78
78
 
79
79
  def_single_delegator :@hash, :size
80
80
  def_single_delegator :@hash, :empty?
81
- def_single_delegator :@hash, :each, 1, 2, -3
82
- def_single_delegator :@hash, :map, 1, 2, -3, -1
83
- def_single_delegator :@hash, :detect, 1
81
+ def_single_delegator :@hash, :each, -1, 1, 2, -3
82
+ def_single_delegator :@hash, :map, -1, 1, 2, -3
83
+ def_single_delegator :@hash, :detect, -1, 1
84
84
  def_single_delegator :@hash, :values
85
85
  def_single_delegator :@hash, :keys
86
86
 
@@ -34,8 +34,9 @@ module ActiveFacts
34
34
 
35
35
  def [](*a)
36
36
  if @sort
37
+ #puts "Indexing #{object_type.name}.#{role.name} using #{a.inspect}:\n\t" + caller*"\n\t" + "\n\t---\n"
38
+ key = form_key(a.map{|a| a.respond_to?(:identifying_role_values) ? a.identifying_role_values : a})
37
39
  # REVISIT: Consider whether to return an array when a partial key is provided.
38
- key = form_key(Array(a))
39
40
  @a[key]
40
41
  else
41
42
  # Slow: Search the array for an element having the matching key:
@@ -127,20 +128,21 @@ module ActiveFacts
127
128
  end
128
129
  end
129
130
 
130
- def_single_delegator :@a, :all?, 1
131
+ # Arity of -1 is needed when a block is passed using to_proc, e.g. map(&:some_method).
132
+ def_single_delegator :@a, :all?, -1, 1
131
133
  def_single_delegator :@a, :empty?
132
134
  def_single_delegator :@a, :include?
133
135
  def_single_delegator :@a, :inject, 2
134
- def_single_delegator :@a, :select, 1
135
- def_single_delegator :@a, :reject, 1
136
+ def_single_delegator :@a, :select, -1, 1
137
+ def_single_delegator :@a, :reject, -1, 1
136
138
  def_single_delegator :@a, :size
137
- def_single_delegator :@a, :sort_by, 1, -1
139
+ def_single_delegator :@a, :sort_by, -1, 1
138
140
  def_single_delegator :@a, :to_a
139
141
  def_single_delegator :@a, :-
140
142
  # These delegators allow a negative arity in RSpec because the tests test it (to make sure the code doesn't pass too many args)
141
- def_single_delegator :@a, :each, *([1] + Array(defined?(::RSpec) ? -2 : nil))
142
- def_single_delegator :@a, :detect, 1, *([1] + Array(defined?(::RSpec) ? -2 : nil))
143
- def_single_delegator :@a, :map, 1, -1
143
+ def_single_delegator :@a, :each, *([-1, 1] + Array(defined?(::RSpec) ? -2 : nil))
144
+ def_single_delegator :@a, :detect, 1, *([-1, 1] + Array(defined?(::RSpec) ? -2 : nil))
145
+ def_single_delegator :@a, :map, -1, 1
144
146
  end
145
147
  end
146
148
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveFacts
2
2
  module API
3
- VERSION = "1.9.2"
3
+ VERSION = "1.9.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activefacts-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.2
4
+ version: 1.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clifford Heath
@@ -37,6 +37,9 @@ dependencies:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
39
  version: '2'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 2.0.4
40
43
  type: :runtime
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -44,6 +47,9 @@ dependencies:
44
47
  - - "~>"
45
48
  - !ruby/object:Gem::Version
46
49
  version: '2'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 2.0.4
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: bundler
49
55
  requirement: !ruby/object:Gem::Requirement