Sha256: 35b00fe34b6d7f0d41835d12a022d13a659f69dcbca2fec735872e66822fb125
Contents?: true
Size: 1.66 KB
Versions: 18
Compression:
Stored size: 1.66 KB
Contents
module Nanoc::Int # @api private class DependencyTracker include Nanoc::Int::ContractsSupport C_OBJ = C::Or[Nanoc::Int::Item, Nanoc::Int::Layout] C_ARGS = C::KeywordArgs[raw_content: C::Optional[C::Bool], attributes: C::Optional[C::Bool], compiled_content: C::Optional[C::Bool], path: C::Optional[C::Bool]] class Null include Nanoc::Int::ContractsSupport contract C_OBJ, C_ARGS => C::Any def enter(_obj, raw_content: false, attributes: false, compiled_content: false, path: false); end contract C_OBJ => C::Any def exit; end contract C_OBJ, C_ARGS => C::Any def bounce(_obj, raw_content: false, attributes: false, compiled_content: false, path: false); end end def initialize(dependency_store) @dependency_store = dependency_store @stack = [] end contract C_OBJ, C_ARGS => C::Any def enter(obj, raw_content: false, attributes: false, compiled_content: false, path: false) unless @stack.empty? Nanoc::Int::NotificationCenter.post(:dependency_created, @stack.last, obj) @dependency_store.record_dependency( @stack.last, obj, raw_content: raw_content, attributes: attributes, compiled_content: compiled_content, path: path, ) end @stack.push(obj) end contract C_OBJ => C::Any def exit @stack.pop end contract C_OBJ, C_ARGS => C::Any def bounce(obj, raw_content: false, attributes: false, compiled_content: false, path: false) enter(obj, raw_content: raw_content, attributes: attributes, compiled_content: compiled_content, path: path) exit end end end
Version data entries
18 entries across 18 versions & 1 rubygems