Class: RubimCode::LoopCounter

Inherits:
UserVariable show all
Defined in:
lib/rubimc.rb

Overview

ToDo: в Ruby присваивание значений индексной переменной не должно влиять на выполнение цикла например следующий цикл будет выполнен ровно 10 раз for var in 1..10; var = var+2; end

Instance Attribute Summary

Attributes inherited from UserVariable

#name, #type

Instance Method Summary collapse

Methods inherited from UserVariable

#!=, #!@, #%, #&, #*, #**, #+, #+@, #-, #-@, #/, #<, #<<, #<=, #==, #>, #>=, #>>, #^, #c_assign=, #common_operator, #times, #to_bool, #to_i, #to_rubim, #|, #~@

Constructor Details

#initializeLoopCounter

Returns a new instance of LoopCounter.



141
142
143
144
145
# File 'lib/rubimc.rb', line 141

def initialize
  name = "i" + RubimCode.level.to_s
  # ToDo - вместо "i" - __rubim__i
  super(name)
end

Instance Method Details

#to_sObject



147
148
149
# File 'lib/rubimc.rb', line 147

def to_s
  self.name
end