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.
54 55 56 57 58 59 |
# File 'lib/nanoc/helpers/capturing.rb', line 54 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.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/nanoc/helpers/capturing.rb', line 61 def run rep = @requested_item.reps[:default]._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? # FIXME: is :last appropriate? Fiber.yield(Nanoc::Core::Errors::UnmetDependency.new(rep, :last)) return run end end compiled_content_store = @config._context.compiled_content_store content = compiled_content_store.get(rep, :"__capture_#{@name}") content&.string end |