Class: Wardite::Table
- Inherits:
-
Object
- Object
- Wardite::Table
- Defined in:
- lib/wardite.rb
Instance Attribute Summary collapse
-
#current ⇒ Object
: Integer.
-
#max ⇒ Object
: Integer|nil.
-
#refs ⇒ Object
: Array.
-
#type ⇒ Object
: Symbol.
Instance Method Summary collapse
-
#initialize(type, init, max) ⇒ Table
constructor
A new instance of Table.
- #set(idx, elem) ⇒ Object
Constructor Details
#initialize(type, init, max) ⇒ Table
Returns a new instance of Table.
1138 1139 1140 1141 1142 1143 1144 |
# File 'lib/wardite.rb', line 1138 def initialize(type, init, max) @type = type @current = init @max = max @refs = Array.new(3, nil) end |
Instance Attribute Details
#current ⇒ Object
: Integer
1128 1129 1130 |
# File 'lib/wardite.rb', line 1128 def current @current end |
#max ⇒ Object
: Integer|nil
1130 1131 1132 |
# File 'lib/wardite.rb', line 1130 def max @max end |
#type ⇒ Object
: Symbol
1126 1127 1128 |
# File 'lib/wardite.rb', line 1126 def type @type end |
Instance Method Details
#set(idx, elem) ⇒ Object
1149 1150 1151 1152 1153 1154 |
# File 'lib/wardite.rb', line 1149 def set(idx, elem) if idx >= @current raise GenericError, "idx too large for table" end @refs[idx] = elem end |