Sha256: 8c5731e534a3259f0eef26ae9a6dda0857354cf46fabec6b0ac6b3ae7ceacce3

Contents?: true

Size: 610 Bytes

Versions: 12

Compression:

Stored size: 610 Bytes

Contents

class Volt
  class Environment
    def initialize
      @env = ENV['VOLT_ENV']

      # If we're in opal, we can set the env from JS before opal loads
      if RUBY_PLATFORM == 'opal'
        unless @env
          `if (window.start_env) {`
            @env = `window.start_env`
          `}`
        end
      end

      @env ||= 'development'
    end

    def ==(val)
      @env == val
    end

    def production?
      self.==('production')
    end

    def test?
      self.==('test')
    end

    def development?
      self.==('development')
    end

    def inspect
      @env.inspect
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
volt-0.8.2 lib/volt/volt/environment.rb
volt-0.8.1 lib/volt/volt/environment.rb
volt-0.8.0 lib/volt/volt/environment.rb
volt-0.7.23 lib/volt/volt/environment.rb
volt-0.7.22 lib/volt/volt/environment.rb
volt-0.7.21 lib/volt/volt/environment.rb
volt-0.7.20 lib/volt/volt/environment.rb
volt-0.7.19 lib/volt/volt/environment.rb
volt-0.7.18 lib/volt/volt/environment.rb
volt-0.7.17 lib/volt/volt/environment.rb
volt-0.7.16 lib/volt/volt/environment.rb
volt-0.7.15 lib/volt/volt/environment.rb