Class: JasmineParser::SharedBehaviorDeclaration

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

Instance Attribute Summary

Attributes inherited from Node

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

Instance Method Summary collapse

Methods inherited from Node

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

Constructor Details

This class inherits a constructor from JasmineParser::Node

Instance Method Details

#delete!Object

TODO: Export delete! to module ToDo: write tests for delete method



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

def delete!
  self.parent.children.delete(self)
  self.parent = nil
end

#ready_to_be_adopted?Boolean

ToDo: write tests for ready_to_be_adopted?

Returns:

  • (Boolean)


45
46
47
48
49
50
51
# File 'lib/jasmine-parser/nodes/shared_behavior_decl_node.rb', line 45

def ready_to_be_adopted?
  not_ready_to_be_adopted = children.collect do |child|
    child if child.type == :shared_behavior_invocation and child.ready_to_be_adopted? == false
  end.compact

  not_ready_to_be_adopted.empty?
end

#typeObject



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

def type
  :shared_behavior_declaration
end