Class: Builder::BlankSlate

### Home Classes Methods

### In Files

- lib/blankslate.rb

### Parent

Object

### Methods

- ::find_hidden_method
- ::hide
- ::reveal

### Files

- CHANGES
- MIT-LICENSE
- Rakefile
- builder-1.2.4.rdoc
- builder-2.0.0.rdoc
- builder-2.1.1.rdoc

### Class/Module Index

Quicksearch

- Builder
- Builder::BlankSlate
- Builder::IllegalBlockError
- Builder::XmlBase
- Builder::XmlEvents
- Builder::XmlMarkup
- BlankSlate
- Fixnum
- Kernel
- Module
- Object
- String
- Symbol

No matching classes.

# Builder::BlankSlate

BlankSlate provides an abstract base class with no predefined methods (except for `__send__` and `__id__`). BlankSlate is useful as a base class when writing classes that depend upon `method_missing` (e.g. dynamic proxies).

### Public Class Methods

find_hidden_method(name) click to toggle source

    # File lib/blankslate.rb, line 59
    def find_hidden_method(name)
      @hidden_methods ||= {}
      @hidden_methods[name] || superclass.find_hidden_method(name)
    end

hide(name) click to toggle source

Hide the method named `name` in the BlankSlate class. Don't hide `instance_eval` or any method beginning with "__".

    # File lib/blankslate.rb, line 46
    def hide(name)
      warn_level = $VERBOSE
      $VERBOSE = nil
      if instance_methods.include?(name._blankslate_as_name) &&
          name !~ /^(__|instance_eval$)/
        @hidden_methods ||= {}
        @hidden_methods[name.to_sym] = instance_method(name)
        undef_method name
      end
    ensure
      $VERBOSE = warn_level
    end

reveal(name) click to toggle source

Redefine a previously hidden method so that it may be called on a blank slate object.

    # File lib/blankslate.rb, line 66
    def reveal(name)
      hidden_method = find_hidden_method(name)
      fail "Don't know how to reveal method '#{name}'" unless hidden_method
      define_method(name, hidden_method)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.