Sha256: d525069ebb1f3fa0a30f9ba2458a40629eaadc036b4eab2cef66f7fa58b80986
Contents?: true
Size: 2 KB
Versions: 2
Compression:
Stored size: 2 KB
Contents
module Lucid module AST # This class holds an array of Step or StepDefinition. class StepCollection #:nodoc: include Enumerable def initialize(steps) @steps = steps @steps.each{|step| step.step_collection = self} end def inspect @steps.map { |s| [s.class, s.object_id] }.join(', ') end def accept(visitor) return if Lucid.wants_to_quit @steps.each do |step| visitor.visit_step(step) end end def step_invocations(background = false) StepCollection.new(@steps.map{ |step| i = step.step_invocation i.background = background i }) end def skip_invoke! @steps.each{|step_invocation| step_invocation.skip_invoke!} end def step_invocations_from_cells(cells) @steps.map{|step| step.step_invocation_from_cells(cells)} end def +(step_invocations) dup(step_invocations) end # Duplicates this instance and adds +step_invocations+ to the end def dup(step_invocations = []) StepCollection.new(@steps + step_invocations) end def each(&proc) @steps.each(&proc) end def previous_step(step) i = @steps.index(step) || -1 @steps[i-1] end def empty? @steps.empty? end def max_line_length(feature_element) lengths = (@steps + [feature_element]).map{|e| e.text_length} lengths.max end def exception @exception ||= ((failed = @steps.detect {|step| step.exception}) && failed.exception) end def failed? status == :failed end def passed? status == :passed end def status @steps.each{|step_invocation| return step_invocation.status if step_invocation.status != :passed} :passed end def length @steps.length end def to_sexp @steps.map{|step| step.to_sexp} end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lucid-0.0.6 | lib/lucid/ast/step_collection.rb |
lucid-0.0.5 | lib/lucid/ast/step_collection.rb |