Class: CIM::Array
Overview
Array represents an array of identical typed value
Constant Summary
Constants inherited from Type
Type::MATCHES, Type::NORMALIZE, Type::TYPES
Instance Attribute Summary collapse
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Attributes inherited from Type
Instance Method Summary collapse
-
#==(t) ⇒ Object
An array is equal to any other array, regardless of the enclosed type.
- #array? ⇒ Boolean
-
#initialize(size, type) ⇒ Array
constructor
Arrays are initialized by size and type Passing 0 (zero) as the size creates an unlimited array.
-
#to_s ⇒ Object
returns a string representation of the array type.
Methods inherited from Type
Constructor Details
#initialize(size, type) ⇒ Array
Arrays are initialized by size and type Passing 0 (zero) as the size creates an unlimited array
187 188 189 190 |
# File 'lib/cim/type.rb', line 187 def initialize size, type @size = size super type end |
Instance Attribute Details
#size ⇒ Object (readonly)
Returns the value of attribute size.
182 183 184 |
# File 'lib/cim/type.rb', line 182 def size @size end |
Instance Method Details
#==(t) ⇒ Object
An array is equal to any other array, regardless of the enclosed type
197 198 199 |
# File 'lib/cim/type.rb', line 197 def == t t == :array end |
#array? ⇒ Boolean
191 192 193 |
# File 'lib/cim/type.rb', line 191 def array? true end |
#to_s ⇒ Object
returns a string representation of the array type
203 204 205 206 207 208 209 |
# File 'lib/cim/type.rb', line 203 def to_s if @size > 0 "#{super}[#{@size}]" else "#{super}[]" end end |