Class: Dogviz::Container
- Inherits:
-
Object
- Object
- Dogviz::Container
- Defined in:
- lib/dogviz/container.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#render_options ⇒ Object
readonly
Returns the value of attribute render_options.
-
#render_type ⇒ Object
readonly
Returns the value of attribute render_type.
Instance Method Summary collapse
- #auto_nominate? ⇒ Boolean
-
#initialize(parent, name, options = {}) ⇒ Container
constructor
A new instance of Container.
- #register(name, thing) ⇒ Object
- #render(renderer) ⇒ Object
- #render_edges(renderer) ⇒ Object
Methods included from Parent
#add, #container, #find, #find_all, #group, #logical_container, #root?, #thing
Methods included from Nominator
Methods included from Common
#ancestors, #create_id, #doclink, #in_rollup?, #in_skip?, #info, #inherited_render_options, #label_with_info, #on_top_rollup?, #rollup!, #rollup?, #root, #setup_render_attributes, #skip!, #skip?, #under_rollup?, #under_skip?
Constructor Details
#initialize(parent, name, options = {}) ⇒ Container
Returns a new instance of Container.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dogviz/container.rb', line 14 def initialize(parent, name, = {}) @children = [] @by_name = Registry.new name @parent = parent @name = name @id = create_id(name, parent) @skip = false @info = {} init_rollup setup_render_attributes label: name default_bounded_option() @render_options = .merge() parent.register name, self end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
12 13 14 |
# File 'lib/dogviz/container.rb', line 12 def children @children end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/dogviz/container.rb', line 12 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/dogviz/container.rb', line 12 def name @name end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
12 13 14 |
# File 'lib/dogviz/container.rb', line 12 def node @node end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
11 12 13 |
# File 'lib/dogviz/container.rb', line 11 def parent @parent end |
#render_options ⇒ Object (readonly)
Returns the value of attribute render_options.
12 13 14 |
# File 'lib/dogviz/container.rb', line 12 def @render_options end |
#render_type ⇒ Object (readonly)
Returns the value of attribute render_type.
12 13 14 |
# File 'lib/dogviz/container.rb', line 12 def render_type @render_type end |
Instance Method Details
#auto_nominate? ⇒ Boolean
56 57 58 |
# File 'lib/dogviz/container.rb', line 56 def auto_nominate? root.auto_nominate? end |
#register(name, thing) ⇒ Object
33 34 35 36 |
# File 'lib/dogviz/container.rb', line 33 def register(name, thing) @by_name.register name, thing parent.register name, thing end |
#render(renderer) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/dogviz/container.rb', line 38 def render(renderer) if on_top_rollup? do_render_node renderer elsif !under_rollup? do_render_subgraph renderer end children.each { |c| c.render renderer } end |
#render_edges(renderer) ⇒ Object
50 51 52 53 54 |
# File 'lib/dogviz/container.rb', line 50 def render_edges(renderer) children.each { |c| c.render_edges renderer } end |