### Home Classes Methods

### In Files

- lib/facets/erb.rb

### Parent

Object

### Methods

- ::new
- #erb_result

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- Random
- Random::ArrayExtensions
- Random::HashExtensions
- Random::IntegerExtensions
- Random::NumericExtensions
- Random::RangeExtensions
- Random::StringExtensions
- Random::StringExtensions::Self
- FileUtils
- FileUtils::DryRun
- FileUtils::NoWrite
- FileUtils::Verbose
- Digest
- Digest::Class
- Digest::Instance
- Multiton
- Multiton::Inclusive
- Multiton::MetaMethods
- URI
- URI::Hash
- URI::Kernel
- Argvector
- Argvector
- ERB
- ERB::OpenTemplate
- Enumerable
- Enumerable::Arguments
- GetoptLong
- GetoptLong::DSL
- Memoizable
- Memoizable::Copy
- Numeric
- Numeric::Multipliers
- Object
- Object::ArgVector
- Timer
- Timer::Dummy
- Array
- BasicObject
- CGI
- Cloneable
- Continuation
- Date
- DateTime
- Equitable
- File
- Find
- Hash
- Instantiable
- Integer
- Interval
- Kernel
- Math
- Module
- Net
- NilClass
- NullClass
- OpEsc
- OpenStruct
- Pathname
- Platform
- Range
- RbConfig
- Set
- Shellwords
- String
- StringScanner
- Time
- Tuple
- YAML
- Zlib

No matching classes.

# ERB::OpenTemplate

# OpenTemplate

The Erb OpenTemplate provides a quick and convenient way to create a clean rendering space with the desired responses.

Ruby 1.8.6 or less can't handle object scope methods with blocks.

TODO: This might make a good addon library. Just add require 'erb' to the erb_result method? Call it OpenResponse?

### Public Class Methods

new(*objs_ioc) click to toggle source

    # File lib/facets/erb.rb, line 21
    def initialize(*objs_ioc)
      ioc = Hash===objs_ioc.last ? objs_ioc.pop : {}
      objs = objs_ioc

      mods = []

      objs.each do |obj|
        mod = Module.new
        obj.public_methods.each do |m|
          mod.module_eval do
            #define_method(m){ |*a,&b| obj.__send__(m,*a,&b) }
            define_method(m, &obj.method(m).to_proc)
          end
        end
        mods << mod
      end

      mod = Module.new
      ioc.each do |k,v|
        mod.module_eval do
          define_method(k){ v }
        end
      end
      mods << mod

      extend *mods.reverse
    end

### Public Instance Methods

erb_result(str) click to toggle source

    # File lib/facets/erb.rb, line 50
    def erb_result(str)
      ERB.new(str).result(binding)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.