Class: EacTemplates::Modules::Ancestor::File
Constant Summary
collapse
- TEMPLATE_EXTNAME_PATTERN =
/#{::Regexp.quote(::EacTemplates::Variables::FsObject::TEMPLATE_EXTNAME)}\z/.freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from FsObject
#path_for_search, #to_s
#content
#applier, #applier_class, assert, by_subpath, #category_module, #path_for_search, #path_for_search_prefix, #raise_not_found, #source_set, #type, #type_list
Class Method Details
.parse_basename(basename) ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/eac_templates/modules/ancestor/file.rb', line 18
def parse_basename(basename)
basename.if_present do |v|
v.to_pathname
.to_path
.gsub(TEMPLATE_EXTNAME_PATTERN, '')
.to_pathname
end
end
|
Instance Method Details
#basename ⇒ Pathname
39
40
41
|
# File 'lib/eac_templates/modules/ancestor/file.rb', line 39
def basename
self.class.parse_basename(super)
end
|
#found? ⇒ Boolean
29
30
31
|
# File 'lib/eac_templates/modules/ancestor/file.rb', line 29
def found?
source_object.found? || template?
end
|
#path ⇒ Pathname
34
35
36
|
# File 'lib/eac_templates/modules/ancestor/file.rb', line 34
def path
template? ? template_source_object.path : source_object.path
end
|
#template? ⇒ Boolean
44
45
46
|
# File 'lib/eac_templates/modules/ancestor/file.rb', line 44
def template?
template_source_object.found?
end
|