Module: Katuv::NodeBehavior

Defined in:
lib/katuv/node_behavior.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/katuv/node_behavior.rb', line 9

def name
  @name
end

#parentObject (readonly)

Returns the value of attribute parent.



9
10
11
# File 'lib/katuv/node_behavior.rb', line 9

def parent
  @parent
end

Instance Method Details

#childrenObject



23
24
25
# File 'lib/katuv/node_behavior.rb', line 23

def children
  @children ||= {}
end

#each(&block) ⇒ Object



15
16
17
# File 'lib/katuv/node_behavior.rb', line 15

def each(&block)
  children.values.each(&block)
end

#has_children?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/katuv/node_behavior.rb', line 27

def has_children?
  children.any?
end

#initialize(name = nil, opts = {}, &block) ⇒ Object



3
4
5
6
7
8
# File 'lib/katuv/node_behavior.rb', line 3

def initialize(name = nil, opts = {}, &block)
  @parent = opts[:parent]
  @name = name
  @opts = opts
  instance_eval &block if block_given?
end

#run!Object



19
20
21
# File 'lib/katuv/node_behavior.rb', line 19

def run!
  #this sucks
end

#terminal?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/katuv/node_behavior.rb', line 11

def terminal?
  self.class.terminal?
end