class Rye::Tpl

  1. lib/rye.rb
Parent: Rye

Methods

Public Class

  1. new

Public Instance

  1. basename
  2. delete
  3. path
  4. result
  5. result!
  6. src
  7. to_s

Attributes

basename [R]
result [R]
src [R]

Public Class methods

new (src, basename='rye-template')
[show source]
# File lib/rye.rb, line 287
def initialize(src, basename='rye-template')
  @basename = basename
  src = src.to_s
  @src, @template = src, ERB.new(src)
end

Public Instance methods

delete ()
[show source]
# File lib/rye.rb, line 300
def delete
  File.delete(@tf.path) if File.exists?(@tf.path)
end
path ()
[show source]
# File lib/rye.rb, line 292
def path
  if @tf.nil?
    @tf = Tempfile.new basename
    @tf.write @result
    @tf.close
  end
  @tf.path
end
result! (binding)
[show source]
# File lib/rye.rb, line 303
def result!(binding)
  @result = result(binding)
end
to_s ()
[show source]
# File lib/rye.rb, line 309
def to_s() src end