class NForm::CoercionSet

Public Instance Methods

[](key) click to toggle source
# File lib/nform/coercions.rb, line 7
def [](key)
  set[key.to_sym]
end
[]=(key,val) click to toggle source
# File lib/nform/coercions.rb, line 11
def []=(key,val)
  set[key.to_sym] = val
end
fetch(key) click to toggle source
# File lib/nform/coercions.rb, line 15
def fetch(key)
  if v = set[key]
    v
  else
    raise Error, "Undefined coercion: #{key}"
  end
end
method_missing(name,*args,&block) click to toggle source
Calls superclass method
# File lib/nform/coercions.rb, line 27
def method_missing(name,*args,&block)
  if set[name.to_sym]
    set[name.to_sym].call(*args,&block)
  else
    super
  end
end
respond_to_missing?(name,*) click to toggle source
# File lib/nform/coercions.rb, line 23
def respond_to_missing?(name,*)
  set.has_key?(name.to_sym)
end

Private Instance Methods

set() click to toggle source
# File lib/nform/coercions.rb, line 36
def set
  @set ||= {}
end