Class: JasmineParser::SharedBehaviorInvocation

Inherits:
Node
  • Object
show all
Defined in:
lib/jasmine-parser/nodes/shared_behavior_invoc_node.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#children, #filename, #js_object, #line, #parent

Instance Method Summary collapse

Methods inherited from Node

#clone, function_invocation, group, it, root, shared_behavior_declaration, shared_behavior_invocation

Constructor Details

#initialize(args) ⇒ SharedBehaviorInvocation

Returns a new instance of SharedBehaviorInvocation.



38
39
40
41
# File 'lib/jasmine-parser/nodes/shared_behavior_invoc_node.rb', line 38

def initialize(args)
  super
  @adoptable = false
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



55
56
57
# File 'lib/jasmine-parser/nodes/shared_behavior_invoc_node.rb', line 55

def name
  @name
end

Instance Method Details

#adopt_children(former_parent_node) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/jasmine-parser/nodes/shared_behavior_invoc_node.rb', line 56

def adopt_children(former_parent_node)
  raise UnsupportedObjectType unless former_parent_node.kind_of? Node
  return true if adoptable?

  return false unless former_parent_node.ready_to_be_adopted?

  former_parent_node.clone.children.each {|child| self.children << child }

  update_the_parent_for_all_children(self)        
  adopted!
end

#adoptable?Boolean Also known as: ready_to_be_adopted?

Returns:

  • (Boolean)


43
44
45
# File 'lib/jasmine-parser/nodes/shared_behavior_invoc_node.rb', line 43

def adoptable?
  @adoptable
end

#adopted!Object



49
50
51
# File 'lib/jasmine-parser/nodes/shared_behavior_invoc_node.rb', line 49

def adopted!
  @adoptable = true
end

#formatted_nameObject



69
70
71
# File 'lib/jasmine-parser/nodes/shared_behavior_invoc_node.rb', line 69

def formatted_name
  nil
end

#typeObject



33
34
35
# File 'lib/jasmine-parser/nodes/shared_behavior_invoc_node.rb', line 33

def type
  :shared_behavior_invocation
end