Sha256: 380a63f94801d9f515cc548ae44dda5ad7be557997ee6563bcbce7fd1c57e65a

Contents?: true

Size: 467 Bytes

Versions: 10

Compression:

Stored size: 467 Bytes

Contents

require "erb"

class Climine::Template

  def initialize name
    internal_file_path = self.class.file_path(name)
    @path = File.exist?(internal_file_path) ? internal_file_path : name.to_s
  end

  def exist?
    File.exist?(@path)
  end

  def build
    ERB.new(load, nil, "-")
  end

  private
  def load
    File.read(@path)
  end

  class << self
    def file_path name
      "#{File.expand_path(File.dirname(__FILE__))}/template/#{name}.erb"
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
climine-0.1.1 lib/climine/template.rb
climine-0.1.0 lib/climine/template.rb
climine-0.0.8 lib/climine/template.rb
climine-0.0.7 lib/climine/template.rb
climine-0.0.6 lib/climine/template.rb
climine-0.0.5 lib/climine/template.rb
climine-0.0.4 lib/climine/template.rb
climine-0.0.3 lib/climine/template.rb
climine-0.0.2 lib/climine/template.rb
climine-0.0.1 lib/climine/template.rb