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.
1086 1087 1088 1089 1090 1091 1092 |
# File 'lib/wardite.rb', line 1086 def initialize(type, init, max) @type = type @current = init @max = max @refs = Array.new(3, nil) end |
Instance Attribute Details
#current ⇒ Object
: Integer
1076 1077 1078 |
# File 'lib/wardite.rb', line 1076 def current @current end |
#max ⇒ Object
: Integer|nil
1078 1079 1080 |
# File 'lib/wardite.rb', line 1078 def max @max end |
#type ⇒ Object
: Symbol
1074 1075 1076 |
# File 'lib/wardite.rb', line 1074 def type @type end |
Instance Method Details
#set(idx, elem) ⇒ Object
1097 1098 1099 1100 1101 1102 |
# File 'lib/wardite.rb', line 1097 def set(idx, elem) if idx >= @current raise GenericError, "idx too large for table" end @refs[idx] = elem end |