Class: Piggly::Tags::UnconditionalLoopTag
- Inherits:
-
AbstractLoopTag
- Object
- AbstractTag
- AbstractLoopTag
- Piggly::Tags::UnconditionalLoopTag
- Defined in:
- lib/piggly/tags.rb
Overview
Tracks loops that don’t have a boolean condition in the loop statement (LOOP and FOR loops)
Constant Summary
Constants inherited from AbstractTag
Instance Attribute Summary
Attributes inherited from AbstractLoopTag
#count, #ends, #once, #pass, #twice
Attributes inherited from AbstractTag
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from AbstractLoopTag
#==, #clear, #complete?, #description, #initialize, #state, #style, #to_f, #type
Methods inherited from AbstractTag
Constructor Details
This class inherits a constructor from Piggly::Tags::AbstractLoopTag
Class Method Details
.states ⇒ Object
254 255 256 257 |
# File 'lib/piggly/tags.rb', line 254 def self.states super.merge \ 0b0100 => "loop always passes through" end |
Instance Method Details
#ping(value) ⇒ Object
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
# 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 |