Class: MotionPrime::Env

Inherits:
Object
  • Object
show all
Defined in:
motion-prime/env.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



23
24
25
26
27
28
29
# File 'motion-prime/env.rb', line 23

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

Instance Method Details

#==(obj) ⇒ Object



19
20
21
# File 'motion-prime/env.rb', line 19

def ==(obj)
  env == obj
end

#envObject



3
4
5
6
7
8
9
# File 'motion-prime/env.rb', line 3

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

#inspectObject



15
16
17
# File 'motion-prime/env.rb', line 15

def inspect
  env
end

#to_sObject



11
12
13
# File 'motion-prime/env.rb', line 11

def to_s
  env
end