bali 6.0.0 → 6.0.1

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: c204989d01ed35fff4ac549d69c882797ea58b557915343f03c7debc6635db41
4
- data.tar.gz: 80cec7fa79454c9629682b51e418cb0273bc24a4411ba012fdfed57444e74d96
3
+ metadata.gz: 5f2c3170fb8da9fc0a76becddae855901f97cef723cd9db86073e0e2c15d177c
4
+ data.tar.gz: e9555504164bfb3155d281cfbf4d40629c347d178b76b7eaed2c83caacdcfc4a
5
5
  SHA512:
6
- metadata.gz: 37e8e6aef30d862c8a84d9b6a9bf62f6ae9b3e03e4855138cfb62cf9b760f3cc922f01f82995da534019c444de49b2639a43f6bd0ac4adb307a8a9f9ea83cd31
7
- data.tar.gz: 709caff329a50fc00063b40e5d84fdeb8fea58799893b25cd7bf3e379439a2192d059ea0b973d837810176722289d3cf9cc60c080e5ab8dd02fb73095964367f
6
+ metadata.gz: d2241cfc888b7b1c3ea4210c6a0dfc26ba790e8c190631b86d616000fbe4e927bea425f73b1547025c849f9ffc6b01c9f5389129ba9707258c79bf6a31c2c248
7
+ data.tar.gz: 472f04be142d2e7c42549f2927218c3ca57e880c11c86f2a6d409d0682ea76303299a33f065e070fa8ab38821a408a5ad37507f5d7189210d5baf68c231d4be4
@@ -1,14 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support/lazy_load_hooks'
3
+ begin
4
+ require 'active_support/lazy_load_hooks'
4
5
 
5
- ActiveSupport.on_load :action_controller do
6
- require "bali"
7
- ::ActionController::Base.send :include, Bali::Statics::Authorizer
8
- ::ActionController::Base.send :include, Bali::Statics::ScopeRuler
6
+ ActiveSupport.on_load :action_controller do
7
+ require "bali"
8
+ ::ActionController::Base.send :include, Bali::Statics::Authorizer
9
+ ::ActionController::Base.send :include, Bali::Statics::ScopeRuler
9
10
 
10
- if defined? ::ActionController::API
11
- ::ActionController::API.send :include, Bali::Statics::Authorizer
12
- ::ActionController::API.send :include, Bali::Statics::ScopeRuler
11
+ if defined? ::ActionController::API
12
+ ::ActionController::API.send :include, Bali::Statics::Authorizer
13
+ ::ActionController::API.send :include, Bali::Statics::ScopeRuler
14
+ end
13
15
  end
16
+ rescue LoadError
14
17
  end
@@ -1,9 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support/lazy_load_hooks'
3
+ begin
4
+ require 'active_support/lazy_load_hooks'
4
5
 
5
- ActiveSupport.on_load :action_view do
6
- require "bali"
7
- ::ActionView::Base.send :include, Bali::Statics::Authorizer
8
- ::ActionView::Base.send :include, Bali::Statics::ScopeRuler
6
+ ActiveSupport.on_load :action_view do
7
+ require "bali"
8
+ ::ActionView::Base.send :include, Bali::Statics::Authorizer
9
+ ::ActionView::Base.send :include, Bali::Statics::ScopeRuler
10
+ end
11
+ rescue LoadError
9
12
  end
@@ -1,8 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support/lazy_load_hooks'
3
+ begin
4
+ require 'active_support/lazy_load_hooks'
4
5
 
5
- ActiveSupport.on_load :active_record do
6
- require "bali"
7
- ::ActiveRecord::Base.send :extend, Bali::Statics::ActiveRecord
6
+ ActiveSupport.on_load :active_record do
7
+ require "bali"
8
+ ::ActiveRecord::Base.send :extend, Bali::Statics::Record
9
+ end
10
+ rescue LoadError
8
11
  end
@@ -23,7 +23,7 @@ class Bali::Role
23
23
  def self.formalize(object)
24
24
  case object
25
25
  when *IDENTIFIER_CLASSES then [object]
26
- when Array then object
26
+ when Array then (object.count == 0 ? nil : object)
27
27
  else formalize(extract_roles_from_object(object))
28
28
  end
29
29
  end
@@ -1,13 +1,2 @@
1
- module Bali::Statics::ActiveRecord
2
- def self.extended(cls)
3
- cls.class_eval do
4
- class << self
5
- attr_accessor :role_field_for_authorization
6
- end
7
-
8
- def self.extract_roles_from method_name
9
- @role_field_for_authorization = method_name
10
- end
11
- end
12
- end
13
- end
1
+ # This class is deprecated. Please use Bali::Statics::Record instead of this.
2
+ Bali::Statics::ActiveRecord = Bali::Statics::Record
@@ -0,0 +1,13 @@
1
+ module Bali::Statics::Record
2
+ def self.extended(cls)
3
+ cls.class_eval do
4
+ class << self
5
+ attr_accessor :role_field_for_authorization
6
+ end
7
+
8
+ def self.extract_roles_from method_name
9
+ @role_field_for_authorization = method_name
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Bali
2
- VERSION = "6.0.0"
2
+ VERSION = "6.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bali
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Notodikromo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-04 00:00:00.000000000 Z
11
+ date: 2020-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -166,6 +166,7 @@ files:
166
166
  - lib/bali/rules.rb
167
167
  - lib/bali/statics/active_record.rb
168
168
  - lib/bali/statics/authorizer.rb
169
+ - lib/bali/statics/record.rb
169
170
  - lib/bali/statics/scope_ruler.rb
170
171
  - lib/bali/tasks/bali/print_rules.rake
171
172
  - lib/bali/version.rb