charcoal 2.6.0 → 2.8.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: 0e0f5357949ef43147b8d283f08389d33a34d88fb5aabfd426458a60b6506dcb
4
+ data.tar.gz: 6fafd57d4ae6a1236236b6dc7c0bd07c9e6f74d18942bf4d28c1eb3fcdfd615a
5
5
  SHA512:
6
- metadata.gz: d359dcf628f8004bc030db392a8f08e84fb422d8731f612b08c75bdb6a42ea31ca5d26677be9687cc771df504c9b9663035ebe4a56cff0e5bbedd94e1d5089e5
7
- data.tar.gz: b025411cf9dac45a1b2858bfa421bc9c60695a35d1621cb156fa262f3abcb383f5f16869692013afcd9a8de923b57b40813bd68cc4c908a0f2a160959b617f6c
6
+ metadata.gz: 8918346db83b8e769a129920b6947287c01b197e677b654f2edc87c0f4add6631d57bb33f72878f0057d9fa73366c0368fb4b9bd48ff83caf7d9d2399ad063e9
7
+ data.tar.gz: 8989c33065aa23601ea61f472f9eea88b6c0b8d45033eec36a7bc80dcfe992c14a52753aa5f6f7486a62a3ed418de07e67ba130bc3c3b6edaa490cf62ea0c5f3
@@ -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.8.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.8.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: 2024-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,40 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.2'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '7.1'
19
+ version: '6.1'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: '5.2'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '7.1'
26
+ version: '6.1'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: actionpack
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - ">="
38
32
  - !ruby/object:Gem::Version
39
- version: '5.2'
40
- - - "<"
41
- - !ruby/object:Gem::Version
42
- version: '7.1'
33
+ version: '6.1'
43
34
  type: :runtime
44
35
  prerelease: false
45
36
  version_requirements: !ruby/object:Gem::Requirement
46
37
  requirements:
47
38
  - - ">="
48
39
  - !ruby/object:Gem::Version
49
- version: '5.2'
50
- - - "<"
51
- - !ruby/object:Gem::Version
52
- version: '7.1'
40
+ version: '6.1'
53
41
  - !ruby/object:Gem::Dependency
54
42
  name: rake
55
43
  requirement: !ruby/object:Gem::Requirement
@@ -64,20 +52,6 @@ dependencies:
64
52
  - - ">="
65
53
  - !ruby/object:Gem::Version
66
54
  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
55
  - !ruby/object:Gem::Dependency
82
56
  name: yard
83
57
  requirement: !ruby/object:Gem::Requirement
@@ -131,14 +105,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
105
  requirements:
132
106
  - - ">="
133
107
  - !ruby/object:Gem::Version
134
- version: '2.7'
108
+ version: '3.1'
135
109
  required_rubygems_version: !ruby/object:Gem::Requirement
136
110
  requirements:
137
111
  - - ">="
138
112
  - !ruby/object:Gem::Version
139
113
  version: '0'
140
114
  requirements: []
141
- rubygems_version: 3.0.3.1
115
+ rubygems_version: 3.5.11
142
116
  signing_key:
143
117
  specification_version: 4
144
118
  summary: Cross-Origin helper for Rails