Sha256: 906b64232dfadc7ba8202c687adeffba3a49ed826a7258690c11f037d8610e49

Contents?: true

Size: 539 Bytes

Versions: 10

Compression:

Stored size: 539 Bytes

Contents

module Evergreen
  class Template
    attr_reader :name, :suite

    def initialize(suite, name)
      @suite = suite
      @name = name
    end

    def root
      suite.root
    end

    def full_path
      File.join(root, Evergreen.template_dir, name)
    end

    def read
      File.read(full_path)
    end
    alias_method :contents, :read

    def escaped_contents
      contents.to_json.gsub("<script>", %{<scr" + "ipt>}).gsub("</script>", %{</scr" + "ipt>})
    end

    def exist?
      File.exist?(full_path)
    end

  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
evergreen-1.3.0 lib/evergreen/template.rb
evergreen-1.2.0 lib/evergreen/template.rb
evergreen-1.1.3 lib/evergreen/template.rb
evergreen-1.1.2 lib/evergreen/template.rb
evergreen-1.1.0 lib/evergreen/template.rb
evergreen-1.0.1 lib/evergreen/template.rb
evergreen-1.0.0 lib/evergreen/template.rb
evergreen-1.0.0.rc lib/evergreen/template.rb
rails31-evergreen-0.4.1 lib/evergreen/template.rb
evergreen-0.4.1 lib/evergreen/template.rb