Module: RailsFaker::EnvironmentFaker

Defined in:
lib/arfy/environment_faker.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(who_ami, *params) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/arfy/environment_faker.rb', line 3

def method_missing(who_ami, *params)
  method = who_ami.to_s
  ends_with_questionmark = method.index("?") == method.length - 1
  if ends_with_questionmark
    env_name_asked = method.slice(0, method.length-1)
    return env_name_asked == ENV['RAILS_ENV'] || self.env
  end
  super
end