Class: IDL::Type::String
Constant Summary
Constants inherited
from IDL::Type
Long, LongLong, Octet, Short, ULong, ULongLong, UShort
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from IDL::Type
#is_complete?, #is_local?, #is_node?, #resolved_node, #resolved_type, #typeerror, #typename
Constructor Details
#initialize(size = nil) ⇒ String
Returns a new instance of String.
243
244
245
|
# File 'lib/ridl/type.rb', line 243
def initialize(size = nil)
@size = size
end
|
Instance Attribute Details
Returns the value of attribute size.
240
241
242
|
# File 'lib/ridl/type.rb', line 240
def size
@size
end
|
Instance Method Details
#instantiate(_context) ⇒ Object
262
263
264
|
# File 'lib/ridl/type.rb', line 262
def instantiate(_context)
self.is_template? ? (Type::String.new(@size.instantiate(_context).value)) : self
end
|
#is_anonymous? ⇒ Boolean
256
257
258
|
# File 'lib/ridl/type.rb', line 256
def is_anonymous?
@size ? true : false
end
|
#is_template? ⇒ Boolean
259
260
261
|
# File 'lib/ridl/type.rb', line 259
def is_template?
(@size && @size.is_a?(IDL::Expression) && @size.is_template?)
end
|
241
|
# File 'lib/ridl/type.rb', line 241
def length; @size; end
|
#narrow(obj) ⇒ Object
246
247
248
249
250
251
252
253
254
255
|
# File 'lib/ridl/type.rb', line 246
def narrow(obj)
typeerror(obj) unless ::String === obj
if @size.nil?
obj
elsif @size < obj.size
typeerror(obj)
else
obj
end
end
|