class RubimCode::UserArray

Attributes

name[RW]
type[RW]

Public Instance Methods

[](index) click to toggle source
Calls superclass method
# File lib/rubimc.rb, line 159
def [](index)
        super index.to_i
end
[]=(index, val) click to toggle source
# File lib/rubimc.rb, line 155
def []=(index, val)
        RubimCode.pout "#{@name}[#{index.to_i}] = #{val.to_s};"
end
each() { |class.new("#{joy_name}")| ... } click to toggle source
# File lib/rubimc.rb, line 163
def each
        n = LoopCounter.new
        RubimCode.pout "for (int #{n}=0; #{n}<#{self.size}; #{n}++) {"
        RubimCode.level +=1
        joy_name = self.name + "[#{n}]"
        yield(self[0].class.new("#{joy_name}"))
        RubimCode.level -=1
        RubimCode.pout "}"
end