Method: Jsonify::BlankSlate.hide

Defined in:
lib/jsonify/blank_slate.rb

.hide(name) ⇒ Object

Hide the method named name in the BlankSlate class. Don’t hide instance_eval or any method beginning with “__”.



22
23
24
25
26
27
28
29
# File 'lib/jsonify/blank_slate.rb', line 22

def hide(name)
  if instance_methods.include?(name.to_s) and
    name !~ /^(__|instance_eval)/
    @hidden_methods ||= {}
    @hidden_methods[name.to_sym] = instance_method(name)
    undef_method name
  end
end