Skip to content

Commit

Permalink
Use numeric comparison to test ruby version
Browse files Browse the repository at this point in the history
  • Loading branch information
Mat-Co authored Nov 24, 2022
1 parent d25d226 commit 84d8c55
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libraries/choregraphie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def initialize(name, &block)
# read all available primitives and make them available with a method
# using their name. It allows to call `check_file '/tmp/titi'` to
# instantiate the CheckFile primitive
delegated_args = RUBY_VERSION < '3' ? '*args, &block' : '*args, **kwargs, &block'
delegated_args = RUBY_VERSION.to_i < 3 ? '*args, &block' : '*args, **kwargs, &block'
Primitive.all.each do |klass|
instance_eval <<-METHOD, __FILE__, __LINE__ + 1
def #{klass.primitive_name}(#{delegated_args})
Expand Down Expand Up @@ -76,7 +76,7 @@ def #{klass.primitive_name}(#{delegated_args})
instance_eval(&block)
end

if RUBY_VERSION < '3'
if RUBY_VERSION.to_i < 3
def method_missing(method, *args, &block) # rubocop:disable Style/MissingRespondToMissing
@self_before_instance_eval.send method, *args, &block
end
Expand Down

0 comments on commit 84d8c55

Please sign in to comment.