Class: Evergreen::Template
- Inherits:
-
Object
- Object
- Evergreen::Template
- Defined in:
- lib/evergreen/template.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#suite ⇒ Object
readonly
Returns the value of attribute suite.
Instance Method Summary collapse
- #escaped_contents ⇒ Object
- #exist? ⇒ Boolean
- #full_path ⇒ Object
-
#initialize(suite, name) ⇒ Template
constructor
A new instance of Template.
- #read ⇒ Object (also: #contents)
- #root ⇒ Object
Constructor Details
#initialize(suite, name) ⇒ Template
Returns a new instance of Template.
5 6 7 8 |
# File 'lib/evergreen/template.rb', line 5 def initialize(suite, name) @suite = suite @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/evergreen/template.rb', line 3 def name @name end |
#suite ⇒ Object (readonly)
Returns the value of attribute suite.
3 4 5 |
# File 'lib/evergreen/template.rb', line 3 def suite @suite end |
Instance Method Details
#escaped_contents ⇒ Object
23 24 25 |
# File 'lib/evergreen/template.rb', line 23 def escaped_contents contents.to_json.gsub("<script>", %{<scr" + "ipt>}).gsub("</script>", %{</scr" + "ipt>}) end |
#exist? ⇒ Boolean
27 28 29 |
# File 'lib/evergreen/template.rb', line 27 def exist? File.exist?(full_path) end |
#full_path ⇒ Object
14 15 16 |
# File 'lib/evergreen/template.rb', line 14 def full_path File.join(root, Evergreen.template_dir, name) end |
#read ⇒ Object Also known as: contents
18 19 20 |
# File 'lib/evergreen/template.rb', line 18 def read File.read(full_path) end |
#root ⇒ Object
10 11 12 |
# File 'lib/evergreen/template.rb', line 10 def root suite.root end |