charcoal 2.6.0 → 2.7.0

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: ee5974176d062ce616cac08d60584168a81fd7ab88a2920da202d9e16b8fae63
4
- data.tar.gz: 7ec6eae8fc7d04e95199e5611448398a8d89d7c6898822cd7d75febfecd9ac5a
3
+ metadata.gz: 00474cda870869c981bbaa283926961a92c19ae17907569765b4172c28969941
4
+ data.tar.gz: e3ef579eede5c0b88c0df4b7b0da9f4e402d82457d8f1adad7ccf147f8a3e75a
5
5
  SHA512:
6
- metadata.gz: d359dcf628f8004bc030db392a8f08e84fb422d8731f612b08c75bdb6a42ea31ca5d26677be9687cc771df504c9b9663035ebe4a56cff0e5bbedd94e1d5089e5
7
- data.tar.gz: b025411cf9dac45a1b2858bfa421bc9c60695a35d1621cb156fa262f3abcb383f5f16869692013afcd9a8de923b57b40813bd68cc4c908a0f2a160959b617f6c
6
+ metadata.gz: 2adcee378a347920adf63fcd56939106c69d53901cc378e4ec192a420dbec304f96efb32959f29f56a8065e31c59d130ba59bb4d48b95e6282c34ef52d8f782c
7
+ data.tar.gz: 36a08ff680798e4e6427ba6ef51edce94d524718540477718e8a39a9dbd45a14c61108473845e307732a1bda152a8628e4da54cfd905294ac82db80b003b3c1d
@@ -15,10 +15,10 @@ module Charcoal
15
15
  methods = args.map(&:to_sym)
16
16
  methods = [:all] if methods.empty?
17
17
 
18
- if options[:unless]
19
- directive = lambda {|c| !parse_directive(options[:unless]).call(c)}
18
+ directive = if options[:unless]
19
+ lambda { |c| !parse_directive(options[:unless]).call(c) }
20
20
  else
21
- directive = parse_directive(options[:if] || true)
21
+ parse_directive(options[:if] || true)
22
22
  end
23
23
 
24
24
  methods.each do |method|
@@ -34,9 +34,9 @@ module Charcoal
34
34
  return directive if directive.respond_to?(:call)
35
35
 
36
36
  if directive.respond_to?(:to_sym) && method_defined?(directive.to_sym)
37
- lambda {|c| c.send(directive.to_sym)}
37
+ lambda { |c| c.send(directive.to_sym) }
38
38
  else
39
- lambda {|c| directive}
39
+ lambda { |c| directive }
40
40
  end
41
41
  end
42
42
  end
@@ -1,13 +1,13 @@
1
- require 'charcoal/controller_filter'
1
+ require "charcoal/controller_filter"
2
2
 
3
3
  module Charcoal
4
4
  module CrossOrigin
5
5
  def self.included(klass)
6
6
  klass.extend(ClassMethods)
7
7
  if klass.respond_to?(:around_action)
8
- klass.around_action :set_cors_headers_filter, :if => :cors_allowed?
8
+ klass.around_action :set_cors_headers_filter, if: :cors_allowed?
9
9
  else
10
- klass.around_filter :set_cors_headers_filter, :if => :cors_allowed?
10
+ klass.around_filter :set_cors_headers_filter, if: :cors_allowed?
11
11
  end
12
12
  end
13
13
 
@@ -15,7 +15,7 @@ module Charcoal
15
15
  include ControllerFilter
16
16
 
17
17
  def cors_allowed
18
- @cors_allowed ||= Hash.new(lambda {|_| false})
18
+ @cors_allowed ||= Hash.new(lambda { |_| false })
19
19
  end
20
20
 
21
21
  allow :cors do |method, directive|
@@ -1,9 +1,9 @@
1
1
  # This controller handles CORS preflight requests
2
2
  # See https://developer.mozilla.org/En/HTTP_access_control for documentation
3
3
 
4
- require 'action_controller/metal'
5
- require 'active_support/version'
6
- require 'charcoal/utilities'
4
+ require "action_controller/metal"
5
+ require "active_support/version"
6
+ require "charcoal/utilities"
7
7
 
8
8
  class Charcoal::CrossOriginController < ActionController::Metal
9
9
  include AbstractController::Callbacks
@@ -25,10 +25,10 @@ class Charcoal::CrossOriginController < ActionController::Metal
25
25
  set_cors_headers
26
26
  headers["Access-Control-Allow-Methods"] = allowed_methods.join(",").upcase
27
27
  headers["Access-Control-Max-Age"] = Charcoal.configuration["max-age"].to_s
28
- headers['Access-Control-Allow-Headers'] = Charcoal.configuration["allow-headers"].join(",")
28
+ headers["Access-Control-Allow-Headers"] = Charcoal.configuration["allow-headers"].join(",")
29
29
  end
30
30
 
31
- head :ok, :content_type => "text/plain"
31
+ head :ok, content_type: "text/plain"
32
32
  end
33
33
 
34
34
  private
@@ -1,4 +1,4 @@
1
- require 'charcoal/controller_filter'
1
+ require "charcoal/controller_filter"
2
2
 
3
3
  module Charcoal
4
4
  module JSONP
@@ -15,7 +15,7 @@ module Charcoal
15
15
  include ControllerFilter
16
16
 
17
17
  def jsonp_allowed
18
- @jsonp_allowed ||= Hash.new(lambda {|_| false})
18
+ @jsonp_allowed ||= Hash.new(lambda { |_| false })
19
19
  end
20
20
 
21
21
  allow :jsonp do |method, directive|
@@ -41,7 +41,7 @@ module Charcoal
41
41
  def add_jsonp_callback
42
42
  yield
43
43
 
44
- if response.status.to_s.starts_with?('200') && jsonp_request?
44
+ if response.status.to_s.starts_with?("200") && jsonp_request?
45
45
  response.content_type = "application/javascript"
46
46
  response.body = "#{params[:callback]}(#{response.body})"
47
47
  end
@@ -1,4 +1,4 @@
1
- require 'action_controller'
1
+ require "action_controller"
2
2
 
3
3
  module Charcoal::Utilities
4
4
  Routing = defined?(ActionDispatch) ? ActionDispatch::Routing : ActionController::Routing
@@ -15,7 +15,7 @@ module Charcoal::Utilities
15
15
  Routing::HTTP_METHODS.select do |verb|
16
16
  next if verb == :options
17
17
 
18
- route = find_route(request.path, request.env.merge(:method => verb))
18
+ route = find_route(request.path, request.env.merge(method: verb))
19
19
 
20
20
  if route
21
21
  controller = route[:controller].camelize
@@ -28,7 +28,7 @@ module Charcoal::Utilities
28
28
  instance.response = response
29
29
 
30
30
  method_name = "#{protocol}_allowed"
31
- controller.respond_to?(method_name.to_sym) && controller.send(method_name + '?', instance, action)
31
+ controller.respond_to?(method_name.to_sym) && controller.send(method_name + "?", instance, action)
32
32
  else
33
33
  false
34
34
  end
@@ -40,13 +40,11 @@ module Charcoal::Utilities
40
40
 
41
41
  railties = Rails.application.railties
42
42
  railties = railties.respond_to?(:all) ? railties.all : railties._all
43
- routes += railties.select {|tie| tie.is_a?(Rails::Engine)}.map(&:routes)
43
+ routes += railties.select { |tie| tie.is_a?(Rails::Engine) }.map(&:routes)
44
44
 
45
45
  routes.each do |route_set|
46
- begin
47
- return route_set.recognize_path(path, env)
48
- rescue ActionController::RoutingError
49
- end
46
+ return route_set.recognize_path(path, env)
47
+ rescue ActionController::RoutingError
50
48
  end
51
49
 
52
50
  nil
@@ -1,3 +1,3 @@
1
1
  module Charcoal
2
- VERSION = "2.6.0"
2
+ VERSION = "2.7.0"
3
3
  end
data/lib/charcoal.rb CHANGED
@@ -2,17 +2,16 @@ module Charcoal
2
2
  def self.configuration
3
3
  @configuration ||= {
4
4
  "credentials" => true,
5
- "expose-headers" => %w{},
6
- "allow-headers" => %w{X-Requested-With X-Prototype-Version},
5
+ "expose-headers" => %w[],
6
+ "allow-headers" => %w[X-Requested-With X-Prototype-Version],
7
7
  "max-age" => 86400,
8
8
  "allow-origin" => "*"
9
9
  }
10
10
  end
11
11
 
12
- autoload :ControllerFilter, 'charcoal/controller_filter'
13
- autoload :CrossOrigin, 'charcoal/cross_origin'
14
- autoload :JSONP, 'charcoal/jsonp'
12
+ autoload :ControllerFilter, "charcoal/controller_filter"
13
+ autoload :CrossOrigin, "charcoal/cross_origin"
14
+ autoload :JSONP, "charcoal/jsonp"
15
15
 
16
- autoload :CrossOriginController, 'charcoal/cross_origin_controller'
16
+ autoload :CrossOriginController, "charcoal/cross_origin_controller"
17
17
  end
18
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: charcoal
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.0
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Davidovitz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-18 00:00:00.000000000 Z
11
+ date: 2023-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '5.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7.1'
22
+ version: '7.2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '5.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7.1'
32
+ version: '7.2'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: actionpack
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '5.2'
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '7.1'
42
+ version: '7.2'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: '5.2'
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '7.1'
52
+ version: '7.2'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: rake
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -64,20 +64,6 @@ dependencies:
64
64
  - - ">="
65
65
  - !ruby/object:Gem::Version
66
66
  version: '0'
67
- - !ruby/object:Gem::Dependency
68
- name: bump
69
- requirement: !ruby/object:Gem::Requirement
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- version: '0'
74
- type: :development
75
- prerelease: false
76
- version_requirements: !ruby/object:Gem::Requirement
77
- requirements:
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- version: '0'
81
67
  - !ruby/object:Gem::Dependency
82
68
  name: yard
83
69
  requirement: !ruby/object:Gem::Requirement