Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Improve Ruby 2.6 compatibility hack
Browse files Browse the repository at this point in the history
  • Loading branch information
kodnin committed Aug 11, 2021
1 parent 5caf08c commit fd583fb
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lib/image_vise/pipeline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ def empty?
@ops.empty?
end

if RUBY_VERSION.start_with?("2.6")
def method_missing(method_name, *args, &blk)
operator_builder = ImageVise.operator_from(method_name)
self << operator_builder.new(*args)
end
else
def method_missing(method_name, args = {}, &blk)
operator_builder = ImageVise.operator_from(method_name)
def method_missing(method_name, args = {}, &blk)
operator_builder = ImageVise.operator_from(method_name)

if args.empty? # TODO: remove conditional after dropping Ruby 2.6 support
self << operator_builder.new
else
self << operator_builder.new(**args)
end
end
Expand Down

0 comments on commit fd583fb

Please sign in to comment.