Class: Prow::Template

Inherits:
Struct
  • Object
show all
Defined in:
lib/prow/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



2
3
4
# File 'lib/prow/template.rb', line 2

def path
  @path
end

#templates_pathObject

Returns the value of attribute templates_path

Returns:

  • (Object)

    the current value of templates_path



2
3
4
# File 'lib/prow/template.rb', line 2

def templates_path
  @templates_path
end

Instance Method Details

#contentObject



11
12
13
# File 'lib/prow/template.rb', line 11

def content
  @content ||= File.read(path)
end

#nameObject



7
8
9
# File 'lib/prow/template.rb', line 7

def name
  name_path_parts.join('/')
end

#name_path_partsObject



23
24
25
# File 'lib/prow/template.rb', line 23

def name_path_parts
  (path_parts - [type]).map {|e| e.split('.').first }
end

#partial_pathObject



15
16
17
# File 'lib/prow/template.rb', line 15

def partial_path
  path.gsub(templates_path, '')
end

#path_partsObject



19
20
21
# File 'lib/prow/template.rb', line 19

def path_parts
  partial_path.split("/").select{|p| !p.empty? }
end

#typeObject



3
4
5
# File 'lib/prow/template.rb', line 3

def type
  path_parts.first
end