lib/rack/reducer/refinements.rb in rack-reducer-1.1.2 vs lib/rack/reducer/refinements.rb in rack-reducer-2.0.0
- old
+ new
@@ -1,10 +1,10 @@
# frozen_string_literal: true
module Rack
- module Reducer
- # refine Proc and hash in this scope only
+ class Reducer
+ # Refine a few core classes in Rack::Reducer's scope only
module Refinements
refine Proc do
def required_argument_names
parameters.select { |type, _| type == :keyreq }.map(&:last)
end
@@ -34,9 +34,15 @@
hash[key.to_sym] = val.is_a?(Hash) ? val.symbolize_keys : val
end
end
alias_method :to_unsafe_h, :to_h
+ end
+
+ refine NilClass do
+ def empty?
+ true
+ end
end
end
private_constant :Refinements
end