Class: EacTemplates::Sources::Set
- Defined in:
- lib/eac_templates/sources/set.rb
Class Method Summary collapse
Instance Method Summary collapse
- #directory(subpath) ⇒ EacTemplates::Sources::Directory
- #file(subpath) ⇒ EacTemplates::Sources::Directory
- #included_paths ⇒ EacTemplates::Sources::InternalSet
-
#template(subpath, required = true) ⇒ Object
rubocop:disable Style/OptionalBooleanParameter.
- #to_s ⇒ String
Class Method Details
.default ⇒ Object
9 10 11 |
# File 'lib/eac_templates/sources/set.rb', line 9 def default @default ||= new end |
Instance Method Details
#directory(subpath) ⇒ EacTemplates::Sources::Directory
16 17 18 |
# File 'lib/eac_templates/sources/set.rb', line 16 def directory(subpath) ::EacTemplates::Sources::Directory.by_subpath(self, nil, subpath, source_set: self) end |
#file(subpath) ⇒ EacTemplates::Sources::Directory
22 23 24 |
# File 'lib/eac_templates/sources/set.rb', line 22 def file(subpath) ::EacTemplates::Sources::File.by_subpath(self, nil, subpath, source_set: self) end |
#included_paths ⇒ EacTemplates::Sources::InternalSet
39 40 41 |
# File 'lib/eac_templates/sources/set.rb', line 39 def included_paths @included_paths ||= ::EacTemplates::Sources::InternalSet.new end |
#template(subpath, required = true) ⇒ Object
rubocop:disable Style/OptionalBooleanParameter
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/eac_templates/sources/set.rb', line 26 def template(subpath, required = true) # rubocop:disable Style/OptionalBooleanParameter found_file = file(subpath) return found_file if found_file.found? found_directory = directory(subpath) return found_directory if found_directory.found? return nil unless required raise_template_not_found(subpath) end |
#to_s ⇒ String
44 45 46 |
# File 'lib/eac_templates/sources/set.rb', line 44 def to_s "#{self.class.name}[#{included_paths}]" end |