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.
1041 1042 1043 1044 1045 1046 1047 |
# File 'lib/wardite.rb', line 1041 def initialize(type, init, max) @type = type @current = init @max = max @refs = Array.new(3, nil) end |
Instance Attribute Details
#current ⇒ Object
: Integer
1031 1032 1033 |
# File 'lib/wardite.rb', line 1031 def current @current end |
#max ⇒ Object
: Integer|nil
1033 1034 1035 |
# File 'lib/wardite.rb', line 1033 def max @max end |
#type ⇒ Object
: Symbol
1029 1030 1031 |
# File 'lib/wardite.rb', line 1029 def type @type end |
Instance Method Details
#set(idx, elem) ⇒ Object
1052 1053 1054 1055 1056 1057 |
# File 'lib/wardite.rb', line 1052 def set(idx, elem) if idx >= @current raise GenericError, "idx too large for table" end @refs[idx] = elem end |