class Environment

Public Instance Methods

method_missing(*args) click to toggle source
Calls superclass method
# File lib/kongrations/environment.rb, line 4
def method_missing(*args)
  method = args.first
  return super unless respond_to_missing?(method.to_s)

  create_getter_and_setter(method[0..-2])
  value = args[1]
  send(method, value)
end
respond_to_missing?(method_name, include_private = false) click to toggle source
Calls superclass method
# File lib/kongrations/environment.rb, line 13
def respond_to_missing?(method_name, include_private = false)
  method_name.end_with?('=') || super
end

Private Instance Methods

assign_method?(method) click to toggle source
# File lib/kongrations/environment.rb, line 19
def assign_method?(method)
  method.to_s.end_with?('=')
end
create_getter_and_setter(method) click to toggle source
# File lib/kongrations/environment.rb, line 23
def create_getter_and_setter(method)
  instance_eval(getter_and_setter(method))
end
getter_and_setter(method) click to toggle source
# File lib/kongrations/environment.rb, line 27
def getter_and_setter(method)
  "
    def #{method}=(value)
      @method = value
    end

    def #{method}
      @method
    end
  "
end