class Piggly::Tags::UnconditionalLoopTag

Tracks loops that don't have a boolean condition in the loop statement (LOOP and FOR loops)

Public Class Methods

states() click to toggle source
Calls superclass method Piggly::Tags::AbstractLoopTag::states
# File lib/piggly/tags.rb, line 254
def self.states
  super.merge \
    0b0100 => "loop always passes through"
end

Public Instance Methods

ping(value) click to toggle source
# File lib/piggly/tags.rb, line 259
def ping(value)
  case value
  when "t"
    # start of iteration
    @count += 1
  when "@"
    # end of iteration
    @ends = true
  when "f"
    # loop exit
    case @count
    when 0; @pass = true
    when 1; @once = true
    else;  @twice = true
    end
    @count = 0
  end
end