Class: EacTemplates::Variables::Directory
- Defined in:
- lib/eac_templates/variables/directory.rb
Instance Method Summary collapse
Instance Method Details
#apply(variables_source, directory) ⇒ Object
11 12 13 |
# File 'lib/eac_templates/variables/directory.rb', line 11 def apply(variables_source, directory) ::EacTemplates::Variables::FsObject.new(self, '.', directory, variables_source).apply end |
#child(subpath) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/eac_templates/variables/directory.rb', line 15 def child(subpath) child_path = ::File.join(path, subpath) return ::EacTemplates::Variables::File.new(child_path) if ::File.file?(child_path) return ::EacTemplates::Variables::Directory.new(child_path) if ::File.directory?(child_path) raise ::EacTemplates::Errors::NotFound, "Child \"#{subpath}\" from \"#{path}\" not found" end |
#children ⇒ Object
24 25 26 27 28 |
# File 'lib/eac_templates/variables/directory.rb', line 24 def children path.children.map do |path_child| child(path_child.basename.to_path) end end |