Module: NanDoc::SecretParent

Included in:
Helpers::NanDocHelpers::SiteMap, NanDoc::StreamColorizer::State
Defined in:
lib/nandoc/support/secret-parent.rb

Instance Method Summary collapse

Instance Method Details

#parentObject



17
18
19
# File 'lib/nandoc/support/secret-parent.rb', line 17

def parent
  nil
end

#parent=(mixed) ⇒ 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.

@dependencies: none set parent attribute without it showing up in inspect() dumps



8
9
10
11
12
13
# File 'lib/nandoc/support/secret-parent.rb', line 8

def parent= mixed
  fail("no clear_parent() available yet.") unless mixed
  @has_parent = !! mixed
  class << self; self end.send(:define_method, :parent){mixed}
  mixed # maybe chain assignmnet of 1 parent to several cx at once
end

#parent?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/nandoc/support/secret-parent.rb', line 14

def parent?
  instance_variable_defined?('@has_parent') && @has_parent # no warnings
end