Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/scout_apm/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,19 +190,24 @@ def ruby_3?
@ruby_3 = defined?(RUBY_VERSION) && RUBY_VERSION.match(/^3/)
end

def ruby_4?
return @ruby_4 if defined?(@ruby_4)
@ruby_4 = defined?(RUBY_VERSION) && RUBY_VERSION.match(/^4/)
end

def ruby_minor
return @ruby_minor if defined?(@ruby_minor)
@ruby_minor = defined?(RUBY_VERSION) && RUBY_VERSION.split(".")[1].to_i
end

# Returns true if this Ruby version supports Module#prepend.
def supports_module_prepend?
ruby_2? || ruby_3?
ruby_4? || ruby_3? || ruby_2?
end

# Returns true if this Ruby version makes positional and keyword arguments incompatible
def supports_kwarg_delegation?
ruby_3? || (ruby_2? && ruby_minor >= 7)
ruby_4? || ruby_3? || (ruby_2? && ruby_minor >= 7)
end

# Returns a string representation of the OS (ex: darwin, linux)
Expand Down