Sha256: a723e80eba137dd7b87c8a2ecba4e1a1e847ec3765de5130e5a33eb49a0c19d7

Contents?: true

Size: 1.28 KB

Versions: 11

Compression:

Stored size: 1.28 KB

Contents

require "English"

module ReactOnRails
  module Utils
    def self.object_to_boolean(value)
      [true, "true", "yes", 1, "1", "t"].include?(value.class == String ? value.downcase : value)
    end

    def self.server_rendering_is_enabled?
      ReactOnRails.configuration.server_bundle_js_file.present?
    end

    def self.last_process_completed_successfully?
      # rubocop:disable Style/NumericPredicate
      $CHILD_STATUS.exitstatus == 0
    end

    def self.default_server_bundle_js_file_path
      File.join(ReactOnRails.configuration.generated_assets_dir,
                ReactOnRails.configuration.server_bundle_js_file)
    end

    def self.running_on_windows?
      (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
    end

    def self.rails_version_less_than(version)
      @rails_version_less_than ||= {}

      if @rails_version_less_than.key?(version)
        return @rails_version_less_than[version]
      end

      @rails_version_less_than[version] = begin
        Gem::Version.new(Rails.version) < Gem::Version.new(version)
      end
    end

    def self.rails_version_less_than_4_1_1
      rails_version_less_than("4.1.1")
    end

    module Required
      def required(arg_name)
        raise ArgumentError, "#{arg_name} is required"
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
react_on_rails-8.0.0.beta.2 lib/react_on_rails/utils.rb
react_on_rails-8.0.0.beta.1 lib/react_on_rails/utils.rb
react_on_rails-7.1.0.beta.3 lib/react_on_rails/utils.rb
react_on_rails-7.0.4 lib/react_on_rails/utils.rb
react_on_rails-7.1.0.beta.2 lib/react_on_rails/utils.rb
react_on_rails-7.0.3 lib/react_on_rails/utils.rb
react_on_rails-7.1.0.beta.1 lib/react_on_rails/utils.rb
react_on_rails-7.0.2 lib/react_on_rails/utils.rb
react_on_rails-7.0.1 lib/react_on_rails/utils.rb
react_on_rails-7.0.0 lib/react_on_rails/utils.rb
react_on_rails-6.10.1 lib/react_on_rails/utils.rb