Class: Prow::Template
- Inherits:
-
Struct
- Object
- Struct
- Prow::Template
- Defined in:
- lib/prow/template.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
-
#templates_path ⇒ Object
Returns the value of attribute templates_path.
Instance Method Summary collapse
- #content ⇒ Object
- #name ⇒ Object
- #name_path_parts ⇒ Object
- #partial_path ⇒ Object
- #path_parts ⇒ Object
- #type ⇒ Object
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path
2 3 4 |
# File 'lib/prow/template.rb', line 2 def path @path end |
#templates_path ⇒ Object
Returns the value of attribute templates_path
2 3 4 |
# File 'lib/prow/template.rb', line 2 def templates_path @templates_path end |
Instance Method Details
#content ⇒ Object
11 12 13 |
# File 'lib/prow/template.rb', line 11 def content @content ||= File.read(path) end |
#name ⇒ Object
7 8 9 |
# File 'lib/prow/template.rb', line 7 def name name_path_parts.join('/') end |
#name_path_parts ⇒ Object
23 24 25 |
# File 'lib/prow/template.rb', line 23 def name_path_parts (path_parts - [type]).map {|e| e.split('.').first } end |
#partial_path ⇒ Object
15 16 17 |
# File 'lib/prow/template.rb', line 15 def partial_path path.gsub(templates_path, '') end |
#path_parts ⇒ Object
19 20 21 |
# File 'lib/prow/template.rb', line 19 def path_parts partial_path.split("/").select{|p| !p.empty? } end |
#type ⇒ Object
3 4 5 |
# File 'lib/prow/template.rb', line 3 def type path_parts.first end |