Sha256: 606555af8b7c9604103753001357dc591bd35c56dfa169ac1876fa939ed44ab8

Contents?: true

Size: 1012 Bytes

Versions: 6

Compression:

Stored size: 1012 Bytes

Contents

require 'rails'

module SaferRailsConsole
  module RailsVersion
    RAILS_VERSION = Gem::Version.new(::Rails.version)

    class << self
      def supported?
        four_one? || four_two? || five_zero? || five_one?
      end

      def four_one?
        @is_four_one = Gem::Requirement.new('~> 4.1.0').satisfied_by?(SaferRailsConsole::RailsVersion::RAILS_VERSION) if @is_four_one.nil?
        @is_four_one
      end

      def four_two?
        @is_four_two = Gem::Requirement.new('~> 4.2.0').satisfied_by?(SaferRailsConsole::RailsVersion::RAILS_VERSION) if @is_four_two.nil?
        @is_four_two
      end

      def five_zero?
        @is_five_zero = Gem::Requirement.new('~> 5.0.0').satisfied_by?(SaferRailsConsole::RailsVersion::RAILS_VERSION) if @is_five_zero.nil?
        @is_five_zero
      end

      def five_one?
        @is_five_one = Gem::Requirement.new('~> 5.1.0').satisfied_by?(SaferRailsConsole::RailsVersion::RAILS_VERSION) if @is_five_one.nil?
        @is_five_one
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
safer_rails_console-0.2.0 lib/safer_rails_console/rails_version.rb
safer_rails_console-0.1.4 lib/safer_rails_console/rails_version.rb
safer_rails_console-0.1.3 lib/safer_rails_console/rails_version.rb
safer_rails_console-0.1.2 lib/safer_rails_console/rails_version.rb
safer_rails_console-0.1.1 lib/safer_rails_console/rails_version.rb
safer_rails_console-0.1.0 lib/safer_rails_console/rails_version.rb