scopiform 0.2.1 → 0.2.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
  SHA256:
3
- metadata.gz: ecc39ac0b6ce6d7e5c685fcd9baf94aff3595641362d8ea78cf7b10553d2373b
4
- data.tar.gz: d5cca316fc383e63d2dbc1d76f67eb2aa405c4dee19f973860a7553d8eefca8c
3
+ metadata.gz: 3410bc990d8cdf96301ed976fd2a604f19712ec559a6e7a0e2eb8f384f887ba4
4
+ data.tar.gz: ff9cf85f92087f0cca007130236776532617002c4dfb9e8f557dc2f96b744d1f
5
5
  SHA512:
6
- metadata.gz: beb86577a3d13cbddf15ad2a90bb93d3422c8a3243c09462153977fd95a917d4fdbb3e011466dca362be54a9b3c3a6687341a9215a6fda43e4a7d801a2ae5f37
7
- data.tar.gz: 4510cbd741943ccf3fe7313502997a3ec0430a974569d98e79369e3e0cd5901520ef1cbfada7d708acaef133feb85f09b40a1194e273318e7681ee8563c0164a
6
+ metadata.gz: 7000af69a75cad3e5092d27567280207a3301f6dd507b66d1477ee6695aee22de7ff48b9f547644ae4bb597d6289690f885e1f903dd1710c7513dffa4a14512d
7
+ data.tar.gz: 1c91fb0c3b91dfd73049fc80f1c09895d987ee125754a912ec0a70c55a8833b5db4c858d102569bb78d7f47dd266b1d65ea6e5caf2c7465297804cf419969bfc
@@ -18,7 +18,7 @@ module Scopiform
18
18
  end
19
19
 
20
20
  def auto_scope?(name)
21
- auto_scopes.find { |scope| scope.name == name }
21
+ auto_scopes.find { |scope| scope.name == name }.present?
22
22
  end
23
23
 
24
24
  def auto_scope_add(attribute, block, prefix: nil, suffix: nil, **options)
@@ -58,7 +58,7 @@ module Scopiform
58
58
  end
59
59
 
60
60
  if scope.options[:remove_for_enum]
61
- singleton_class.remove_method scope.name
61
+ singleton_class.send(:remove_method, scope.name)
62
62
  @auto_scopes.delete(scope)
63
63
  end
64
64
  end
@@ -74,7 +74,11 @@ module Scopiform
74
74
 
75
75
  def auto_scope_for_alias(alias_name, scope_definition)
76
76
  alias_scope_definition = scope_definition.dup
77
- alias_scope_definition.attribute = alias_name
77
+ alias_scope_definition.attribute = alias_name.to_sym
78
+
79
+ @auto_scopes ||= []
80
+ @auto_scopes << alias_scope_definition
81
+
78
82
  singleton_class.send(:alias_method, alias_scope_definition.name, scope_definition.name)
79
83
  end
80
84
  end
@@ -43,7 +43,7 @@ module Scopiform
43
43
  def association(name)
44
44
  name = resolve_alias(name)
45
45
  association = reflect_on_association(name)
46
-
46
+
47
47
  association.klass if association.present?
48
48
  association
49
49
  rescue NameError
@@ -14,7 +14,7 @@ module Scopiform
14
14
  end
15
15
 
16
16
  def name_for(attribute_name)
17
- "#{prefix}#{attribute}#{suffix}".underscore.to_sym
17
+ "#{prefix}#{attribute_name}#{suffix}".underscore.to_sym
18
18
  end
19
19
 
20
20
  def dup
@@ -1,3 +1,3 @@
1
1
  module Scopiform
2
- VERSION = '0.2.1'.freeze
2
+ VERSION = '0.2.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scopiform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jayce.pulsipher