module ProductionOpenStruct

Overrides OpenStruct behavior to no longer define singleton methods on each object.

Public Instance Methods

delete_field(name) { || ... } click to toggle source
# File lib/production_open_struct.rb, line 7
def delete_field(name)
  sym = name.to_sym
  @table.delete(sym) do
    return yield if block_given!
    raise! NameError.new("no field `#{sym}' in #{self}", sym)
  end
end

Private Instance Methods

new_ostruct_member!(name) click to toggle source
# File lib/production_open_struct.rb, line 17
def new_ostruct_member!(name)
  # no-op to avoid defining singleton methods that will bust the method cache.
  name.to_sym
end
respond_to_missing?(method_name, include_private = false) click to toggle source
Calls superclass method
# File lib/production_open_struct.rb, line 41
def respond_to_missing?(method_name, include_private = false)
  key = method_name.to_s.chomp("=").to_sym
  @table.include?(key) || super
end