Method: FunctionalLightService::Context#define_accessor_methods_for_keys

Defined in:
lib/functional-light-service/context.rb

#define_accessor_methods_for_keys(keys) ⇒ Object



100
101
102
103
104
105
106
107
108
109
# File 'lib/functional-light-service/context.rb', line 100

def define_accessor_methods_for_keys(keys)
  return if keys.nil?

  keys.each do |key|
    next if respond_to?(key.to_sym)

    define_singleton_method(key.to_s) { fetch(key) }
    define_singleton_method("#{key}=") { |value| self[key] = value }
  end
end