Class: Dogviz::Thing

Inherits:
Object
  • Object
show all
Includes:
Common, Flowable, Nominator
Defined in:
lib/dogviz/thing.rb

Constant Summary collapse

@@colorizer =
Colorizer.new

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Flowable

#does, #method_missing, #note, #receives, #request_handlers, #requests, #start_flow, #stop_flow

Methods included from Nominator

#nominate, #nominate_from

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 = {}) ⇒ Thing

Returns a new instance of Thing.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/dogviz/thing.rb', line 16

def initialize(parent, name, options = {})
  @parent = parent
  @name = name
  @id = create_id(name, parent)
  @pointers = []
  @rollup = false
  @skip = false
  @info = {}
  @edge_heads = []

  rollup! if options[:rollup]
  options.delete(:rollup)

  @render_options = options
  setup_render_attributes({label: name}.merge inherited_render_options)

  parent.register name, self
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Dogviz::Flowable

Instance Attribute Details

#edge_headsObject (readonly)

Returns the value of attribute edge_heads.



12
13
14
# File 'lib/dogviz/thing.rb', line 12

def edge_heads
  @edge_heads
end

#idObject (readonly)

Returns the value of attribute id.



12
13
14
# File 'lib/dogviz/thing.rb', line 12

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/dogviz/thing.rb', line 12

def name
  @name
end

#parentObject (readonly)

Returns the value of attribute parent.



11
12
13
# File 'lib/dogviz/thing.rb', line 11

def parent
  @parent
end

#pointersObject (readonly)

Returns the value of attribute pointers.



12
13
14
# File 'lib/dogviz/thing.rb', line 12

def pointers
  @pointers
end

Instance Method Details

#points_to(other, options = {}) ⇒ Object Also known as: to



41
42
43
44
# File 'lib/dogviz/thing.rb', line 41

def points_to(other, options = {})
  setup_render_edge(other, options)
  other
end

#points_to_all(*others) ⇒ Object Also known as: to_all



35
36
37
38
39
# File 'lib/dogviz/thing.rb', line 35

def points_to_all(*others)
  others.each { |other|
    points_to other
  }
end

#render(renderer) ⇒ Object



49
50
51
# File 'lib/dogviz/thing.rb', line 49

def render(renderer)
  do_render_node(renderer) unless in_rollup? || in_skip?
end

#render_edges(renderer) ⇒ Object



53
54
55
56
57
# File 'lib/dogviz/thing.rb', line 53

def render_edges(renderer)
  pointers.each { |p|
    render_pointer p, renderer
  }
end