Module: Dogviz::Parent
Instance Method Summary collapse
- #add(child) ⇒ Object
- #container(name, options = {}) ⇒ Object
- #find(name = nil, &matcher) ⇒ Object
- #find_all(&matcher) ⇒ Object
- #group(name, options = {}) ⇒ Object
- #logical_container(name, options = {}) ⇒ Object
- #root? ⇒ Boolean
- #thing(name, options = {}) ⇒ Object
Instance Method Details
#add(child) ⇒ Object
33 34 35 36 37 |
# File 'lib/dogviz/parent.rb', line 33 def add(child) @children << child nominate child.name => child if auto_nominate? child end |
#container(name, options = {}) ⇒ Object
21 22 23 |
# File 'lib/dogviz/parent.rb', line 21 def container(name, ={}) add Container.new self, name, end |
#find(name = nil, &matcher) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/dogviz/parent.rb', line 8 def find(name=nil, &matcher) if block_given? @by_name.find(&matcher) else raise 'Need to provide name or block' if name.nil? @by_name.lookup name end end |
#find_all(&matcher) ⇒ Object
3 4 5 6 |
# File 'lib/dogviz/parent.rb', line 3 def find_all(&matcher) raise MissingMatchBlockError.new unless block_given? @by_name.find_all(&matcher) end |
#group(name, options = {}) ⇒ Object
29 30 31 |
# File 'lib/dogviz/parent.rb', line 29 def group(name, ={}) logical_container name, end |
#logical_container(name, options = {}) ⇒ Object
25 26 27 |
# File 'lib/dogviz/parent.rb', line 25 def logical_container(name, ={}) add LogicalContainer.new self, name, end |
#root? ⇒ Boolean
39 40 41 |
# File 'lib/dogviz/parent.rb', line 39 def root? not respond_to?(:parent) end |