Class: Bridgetown::Model::PluginOrigin
- Inherits:
-
RepoOrigin
- Object
- Origin
- RepoOrigin
- Bridgetown::Model::PluginOrigin
- Defined in:
- lib/bridgetown-core/model/plugin_origin.rb
Constant Summary
Constants inherited from Origin
Origin::EAGER_LOAD_DESCENDANTS
Instance Attribute Summary
Attributes inherited from RepoOrigin
#content, #front_matter_line_count
Attributes inherited from Origin
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from RepoOrigin
#collection, data_file_extensions, #exists?, new_with_collection_path, #read, #url, #write
Methods included from FrontMatter::Importer
Methods inherited from Origin
#exists?, #initialize, #read, #verify_model?
Constructor Details
This class inherits a constructor from Bridgetown::Model::Origin
Class Method Details
.handle_scheme?(scheme) ⇒ Boolean
7 8 9 |
# File 'lib/bridgetown-core/model/plugin_origin.rb', line 7 def handle_scheme?(scheme) scheme == "plugin" end |
Instance Method Details
#manifest ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/bridgetown-core/model/plugin_origin.rb', line 12 def manifest @manifest ||= begin manifest_origin = Addressable::URI.unescape(url.path.delete_prefix("/")).split("/").first site.config.source_manifests.find do |manifest| manifest.origin.to_s == manifest_origin end.tap do |manifest| raise "Unable to locate a source manifest for #{manifest_origin}" unless manifest end end end |
#original_path ⇒ Object
29 30 31 |
# File 'lib/bridgetown-core/model/plugin_origin.rb', line 29 def original_path @original_path ||= relative_path.(manifest.content) end |
#relative_path ⇒ Object
23 24 25 26 27 |
# File 'lib/bridgetown-core/model/plugin_origin.rb', line 23 def relative_path @relative_path ||= Pathname.new( Addressable::URI.unescape(url.path.delete_prefix("/")).split("/")[1..].join("/") ) end |