Class: Amiba::Tilt

Inherits:
Object
  • Object
show all
Defined in:
lib/amiba/tilt.rb

Class Method Summary collapse

Class Method Details

.new(obj, options = {}, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/amiba/tilt.rb', line 6

def self.new(obj, options={}, &block)
  if obj.is_a?(String) && File.exist?(obj)
    ::Tilt.new(obj, options)
  else
    if template_class = ::Tilt[obj.filename]
      block ||= proc { obj.content }
      template_class.new(obj.filename, nil, options, &block)
    else
      raise "Can't find a template loader!"
    end
  end
end