Class: RubimCode::UserArray
Overview
end LoopCounter class
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #[](index) ⇒ Object
- #[]=(index, val) ⇒ Object
- #each {|self[0].class.new("#{joy_name}")| ... } ⇒ Object
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
153 154 155 |
# File 'lib/rubimc.rb', line 153 def name @name end |
#type ⇒ Object
Returns the value of attribute type.
153 154 155 |
# File 'lib/rubimc.rb', line 153 def type @type end |
Instance Method Details
#[](index) ⇒ Object
159 160 161 |
# File 'lib/rubimc.rb', line 159 def [](index) super index.to_i end |
#[]=(index, val) ⇒ Object
155 156 157 |
# File 'lib/rubimc.rb', line 155 def []=(index, val) RubimCode.pout "#{@name}[#{index.to_i}] = #{val.to_s};" end |
#each {|self[0].class.new("#{joy_name}")| ... } ⇒ Object
163 164 165 166 167 168 169 170 171 |
# 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 |