Class: EacTemplates::Abstract::FsObject
- Defined in:
- lib/eac_templates/abstract/fs_object.rb
Class Method Summary collapse
- .assert(obj) ⇒ EacTemplates::Abstract::FsObject, EacTemplates::Abstracts::FsObjectByPathname
- .by_subpath(owner, parent_object, subpath, options = {}) ⇒ EacTemplates::Abstract::FsObject
Instance Method Summary collapse
- #applier ⇒ EacTemplates::Variables::Directory, EacTemplates::Variables::File
- #applier_class ⇒ Class
- #category_module ⇒ Module
- #path_for_search ⇒ Pathname
- #path_for_search_prefix ⇒ Pathname
- #raise_not_found(message) ⇒ Object
- #source_set ⇒ EacTemplates::Sources::Set
- #type ⇒ Symbol
- #type_list ⇒ EacRubyUtils::Listable::SymbolList
Class Method Details
.assert(obj) ⇒ EacTemplates::Abstract::FsObject, EacTemplates::Abstracts::FsObjectByPathname
13 14 15 16 17 18 19 |
# File 'lib/eac_templates/abstract/fs_object.rb', line 13 def assert(obj) if obj.is_a?(self) obj else ::EacTemplates::Abstract::FsObjectByPathname.new(obj) end end |
.by_subpath(owner, parent_object, subpath, options = {}) ⇒ EacTemplates::Abstract::FsObject
25 26 27 28 29 30 31 32 |
# File 'lib/eac_templates/abstract/fs_object.rb', line 25 def by_subpath(owner, parent_object, subpath, = {}) r = new(owner, parent_object, nil, ) subpath.if_present(::Pathname.new(''), &:to_pathname).each_filename do |basename| parent_object = r r = new(owner, parent_object, basename, ) end r end |
Instance Method Details
#applier ⇒ EacTemplates::Variables::Directory, EacTemplates::Variables::File
46 47 48 |
# File 'lib/eac_templates/abstract/fs_object.rb', line 46 def applier applier_class.new(self) end |
#applier_class ⇒ Class
51 52 53 |
# File 'lib/eac_templates/abstract/fs_object.rb', line 51 def applier_class ::EacTemplates::Variables.const_get(type.to_s.camelize) end |
#category_module ⇒ Module
56 57 58 |
# File 'lib/eac_templates/abstract/fs_object.rb', line 56 def category_module self.class.module_parent end |
#path_for_search ⇒ Pathname
61 62 63 64 65 66 67 |
# File 'lib/eac_templates/abstract/fs_object.rb', line 61 def path_for_search if parent_object.present? parent_object.path_for_search.join(basename) else path_for_search_prefix.join(basename) end end |
#path_for_search_prefix ⇒ Pathname
70 71 72 |
# File 'lib/eac_templates/abstract/fs_object.rb', line 70 def path_for_search_prefix raise_abstract_method __method__ end |
#raise_not_found(message) ⇒ Object
74 75 76 |
# File 'lib/eac_templates/abstract/fs_object.rb', line 74 def raise_not_found() raise ::EacTemplates::Errors::NotFound, end |
#source_set ⇒ EacTemplates::Sources::Set
79 80 81 |
# File 'lib/eac_templates/abstract/fs_object.rb', line 79 def source_set [OPTION_SOURCE_SET] || ::EacTemplates::Sources::Set.default end |
#type ⇒ Symbol
84 85 86 |
# File 'lib/eac_templates/abstract/fs_object.rb', line 84 def type type_list.value_validate!(self.class.name.demodulize.underscore.to_sym) end |
#type_list ⇒ EacRubyUtils::Listable::SymbolList
89 90 91 |
# File 'lib/eac_templates/abstract/fs_object.rb', line 89 def type_list ::EacTemplates::Abstract::FsObject.lists.type end |