Class: Oktest::SpecLeaf

Inherits:
Item
  • Object
show all
Defined in:
lib/oktest.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent, desc, tag: nil, location: nil, &block) ⇒ SpecLeaf

Returns a new instance of SpecLeaf.



1082
1083
1084
1085
1086
1087
1088
1089
# File 'lib/oktest.rb', line 1082

def initialize(parent, desc, tag: nil, location: nil, &block)
  #@parent = parent      # not keep parent node to avoid recursive reference
  @desc  = desc
  @tag   = tag
  @location = location   # necessary when raising fixture not found error
  @block = block
  parent.add_child(self) if parent
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



1091
1092
1093
# File 'lib/oktest.rb', line 1091

def block
  @block
end

#descObject (readonly)

Returns the value of attribute desc.



1091
1092
1093
# File 'lib/oktest.rb', line 1091

def desc
  @desc
end

#locationObject (readonly)

Returns the value of attribute location.



1091
1092
1093
# File 'lib/oktest.rb', line 1091

def location
  @location
end

#tagObject (readonly)

Returns the value of attribute tag.



1091
1092
1093
# File 'lib/oktest.rb', line 1091

def tag
  @tag
end

Instance Method Details

#-@Object



1120
1121
1122
1123
# File 'lib/oktest.rb', line 1120

def -@
  #; [!bua80] returns self.
  self
end

#_prefixObject



1093
1094
1095
# File 'lib/oktest.rb', line 1093

def _prefix
  '-'
end

#_repr(depth = 0, buf = "") ⇒ Object

:nodoc:



1112
1113
1114
1115
1116
1117
1118
# File 'lib/oktest.rb', line 1112

def _repr(depth=0, buf="")       #:nodoc:
  #; [!6nsgy] builds debug string.
  buf << "  " * depth << "- #{@desc}"
  buf << " (tag: #{@tag.inspect})" if @tag
  buf << "\n"
  return buf
end

#accept_visitor(visitor, *args) ⇒ Object



1102
1103
1104
1105
# File 'lib/oktest.rb', line 1102

def accept_visitor(visitor, *args)
  #; [!ya32z] invokes 'visit_spec()' method of visitor and returns result of it.
  return visitor.visit_spec(self, *args)
end

#run_block_in_context_object(context, *args) ⇒ Object



1097
1098
1099
1100
# File 'lib/oktest.rb', line 1097

def run_block_in_context_object(context, *args)
  #; [!tssim] run spec block in text object.
  context.instance_exec(*args, &@block)
end


1107
1108
1109
1110
# File 'lib/oktest.rb', line 1107

def unlink_parent()
  #; [!e9sv9] do nothing.
  nil
end