Sha256: 5b383ca24e3d6d86b4a521b5d949bd9d32882412c5836451567f745603c50082

Contents?: true

Size: 559 Bytes

Versions: 42

Compression:

Stored size: 559 Bytes

Contents

module MotionPrime
  class Env
    def env
      (defined?(NSBundle) && NSBundle.mainBundle.objectForInfoDictionaryKey('PRIME_ENV')) || 
      ENV['PRIME_ENV'] || 
      ENV['RUBYMOTION_ENV'] || 
      (defined?(RUBYMOTION_ENV) && RUBYMOTION_ENV) || 
      'development'
    end

    def to_s
      env
    end

    def inspect
      env
    end

    def ==(obj)
      env == obj
    end

    def method_missing(name, *args, &block)
      if /(.+)?$/.match(name.to_s)
        env == name.to_s.gsub('?', '')
      else
        false
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
motion-prime-0.5.4 motion-prime/env.rb
motion-prime-0.5.3 motion-prime/env.rb