Class: Protobuf::Field::FieldArray

Inherits:
Array
  • Object
show all
Defined in:
lib/protobuf/message/field.rb

Instance Method Summary collapse

Constructor Details

#initialize(field) ⇒ FieldArray

Returns a new instance of FieldArray.



282
283
284
# File 'lib/protobuf/message/field.rb', line 282

def initialize(field)
  @field = field
end

Instance Method Details

#<<(val) ⇒ Object



290
291
292
# File 'lib/protobuf/message/field.rb', line 290

def <<(val)
  super(normalize(val))
end

#[]=(nth, val) ⇒ Object



286
287
288
# File 'lib/protobuf/message/field.rb', line 286

def []=(nth, val)
  super(nth, normalize(val))
end

#push(val) ⇒ Object



294
295
296
# File 'lib/protobuf/message/field.rb', line 294

def push(val)
  super(normalize(val))
end

#replace(val) ⇒ Object

Raises:

  • (TypeError)


302
303
304
305
306
# File 'lib/protobuf/message/field.rb', line 302

def replace(val)
  raise TypeError unless val.is_a?(Array)
  val = val.map {|v| normalize(v)}
  super(val)
end

#to_sObject



308
309
310
# File 'lib/protobuf/message/field.rb', line 308

def to_s
  "[#{@field.name}]"
end

#unshift(val) ⇒ Object



298
299
300
# File 'lib/protobuf/message/field.rb', line 298

def unshift(val)
  super(normalize(val))
end