Sha256: 0145cd2123a19f63f204066443ddd043a26034063155fbdae2e81825133e991b

Contents?: true

Size: 658 Bytes

Versions: 6

Compression:

Stored size: 658 Bytes

Contents

# frozen_string_literal: true

module Synvert::Core
  # GemSpec checks and compares gem version.
  class Rewriter::RubyVersion
    # Initialize a ruby_version.
    #
    # @param version [String] ruby version
    def initialize(version)
      @version = version
    end

    # Check if the specified ruby version matches current ruby version.
    #
    # @return [Boolean] true if matches, otherwise false.
    def match?
      # Gem::Version initialize will strip RUBY_VERSION directly in ruby 1.9,
      # which is solved from ruby 2.0.0, which calls dup internally.
      Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new(@version)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
synvert-core-0.20.0 lib/synvert/core/rewriter/ruby_version.rb
synvert-core-0.19.0 lib/synvert/core/rewriter/ruby_version.rb
synvert-core-0.18.0 lib/synvert/core/rewriter/ruby_version.rb
synvert-core-0.17.0 lib/synvert/core/rewriter/ruby_version.rb
synvert-core-0.16.1 lib/synvert/core/rewriter/ruby_version.rb
synvert-core-0.16.0 lib/synvert/core/rewriter/ruby_version.rb