Sha256: 7769a921a39e8448d46b53da0dfb4016e2487402d587bc8e84c4d5f7cec69d1b

Contents?: true

Size: 369 Bytes

Versions: 2

Compression:

Stored size: 369 Bytes

Contents

module Paperclip
  class RailsEnvironment
    def self.get
      new.get
    end

    def get
      if rails_exists? && rails_environment_exists?
        Rails.env
      else
        nil
      end
    end

    private

    def rails_exists?
      Object.const_defined?("Rails")
    end

    def rails_environment_exists?
      Rails.respond_to?(:env)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
paperclip-4.3.1 lib/paperclip/rails_environment.rb
paperclip-4.3.0 lib/paperclip/rails_environment.rb