Class: Ikra::Types::ArrayType
- Includes:
- RubyType
- Defined in:
- lib/types/array_type.rb
Class Method Summary collapse
-
.new(inner_type) ⇒ Object
Ensure singleton per class.
Instance Method Summary collapse
-
#initialize(inner_type) ⇒ ArrayType
constructor
A new instance of ArrayType.
- #to_c_type ⇒ Object
- #to_ffi_type ⇒ Object
Methods included from RubyType
#class_id, #is_primitive?, #is_union_type?, #to_ruby_type
Constructor Details
#initialize(inner_type) ⇒ ArrayType
Returns a new instance of ArrayType.
22 23 24 25 26 27 28 |
# File 'lib/types/array_type.rb', line 22 def initialize(inner_type) if not inner_type.is_union_type? raise "Union type expected" end @inner_type = inner_type end |
Class Method Details
.new(inner_type) ⇒ Object
Ensure singleton per class
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/types/array_type.rb', line 10 def new(inner_type) if @cache == nil @cache = {} @cache.default_proc = Proc.new do |hash, key| hash[key] = super(key) end end @cache[inner_type] end |