Class: Nanoc::Helpers::Capturing::GetContent Private
- Inherits:
-
Object
- Object
- Nanoc::Helpers::Capturing::GetContent
- Defined in:
- lib/nanoc/helpers/capturing.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#initialize(requested_item, name, item, config) ⇒ GetContent
constructor
private
A new instance of GetContent.
- #run ⇒ Object private
Constructor Details
#initialize(requested_item, name, item, config) ⇒ GetContent
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of GetContent.
57 58 59 60 61 62 |
# File 'lib/nanoc/helpers/capturing.rb', line 57 def initialize(requested_item, name, item, config) @requested_item = requested_item @name = name @item = item @config = config end |
Instance Method Details
#run ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/nanoc/helpers/capturing.rb', line 64 def run rep_view = @requested_item.reps[:default] rep = rep_view._unwrap # Create dependency if @item.nil? || @requested_item != @item._unwrap dependency_tracker = @config._context.dependency_tracker dependency_tracker.bounce(@requested_item._unwrap, compiled_content: true) unless rep.compiled? rep_view._try_load_from_cache end # If the item rep still isn’t compiled by now, then it can’t be loaded # from the cache and needs to compiled as usual. unless rep.compiled? # FIXME: is :last appropriate? raise Nanoc::Core::Errors::UnmetDependency.new(rep, :last) end end compiled_content_repo = @config._context.compiled_content_repo content = compiled_content_repo.get(rep, :"__capture_#{@name}") content&.string end |