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.



836
837
838
839
840
841
842
843
# File 'lib/oktest.rb', line 836

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.



845
846
847
# File 'lib/oktest.rb', line 845

def block
  @block
end

#descObject (readonly)

Returns the value of attribute desc.



845
846
847
# File 'lib/oktest.rb', line 845

def desc
  @desc
end

#locationObject (readonly)

Returns the value of attribute location.



845
846
847
# File 'lib/oktest.rb', line 845

def location
  @location
end

#tagObject (readonly)

Returns the value of attribute tag.



845
846
847
# File 'lib/oktest.rb', line 845

def tag
  @tag
end

Instance Method Details

#-@Object



874
875
876
877
# File 'lib/oktest.rb', line 874

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

#_prefixObject



847
848
849
# File 'lib/oktest.rb', line 847

def _prefix
  '-'
end

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

:nodoc:



866
867
868
869
870
871
872
# File 'lib/oktest.rb', line 866

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



856
857
858
859
# File 'lib/oktest.rb', line 856

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



851
852
853
854
# File 'lib/oktest.rb', line 851

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


861
862
863
864
# File 'lib/oktest.rb', line 861

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