Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/wood/node.rb
Instance Method Summary collapse
- #===(other) ⇒ Object
- #child_nodes ⇒ Object
- #node_name ⇒ Object
- #parent_node=(parent_node) ⇒ Object
- #set_child(child_name, node_val) ⇒ Object
- #sexp ⇒ Object
Instance Method Details
#===(other) ⇒ Object
232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/wood/node.rb', line 232 def === other case other when Array self.each_with_index do |x, i| return false unless x === other[i] end else return false end return true end |
#child_nodes ⇒ Object
245 246 247 |
# File 'lib/wood/node.rb', line 245 def child_nodes self end |
#node_name ⇒ Object
222 223 224 |
# File 'lib/wood/node.rb', line 222 def node_name :array end |
#parent_node=(parent_node) ⇒ Object
226 227 228 229 230 |
# File 'lib/wood/node.rb', line 226 def parent_node=(parent_node) each do |node| node.parent_node = parent_node if node.respond_to?(:parent_node=) end end |
#set_child(child_name, node_val) ⇒ Object
251 252 253 254 255 256 257 258 |
# File 'lib/wood/node.rb', line 251 def set_child(child_name, node_val) case node_val when nil self.delete_at(child_name) else self[child_name] = node_val end end |
#sexp ⇒ Object
218 219 220 |
# File 'lib/wood/node.rb', line 218 def sexp map(&:sexp) end |