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.



235
236
237
# File 'lib/protobuf/message/field.rb', line 235

def initialize(field)
  @field = field
end

Instance Method Details

#<<(val) ⇒ Object



243
244
245
# File 'lib/protobuf/message/field.rb', line 243

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

#[]=(nth, val) ⇒ Object



239
240
241
# File 'lib/protobuf/message/field.rb', line 239

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

#push(val) ⇒ Object



247
248
249
# File 'lib/protobuf/message/field.rb', line 247

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

#replace(val) ⇒ Object

Raises:

  • (TypeError)


255
256
257
258
259
# File 'lib/protobuf/message/field.rb', line 255

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

#to_sObject



261
262
263
# File 'lib/protobuf/message/field.rb', line 261

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

#unshift(val) ⇒ Object



251
252
253
# File 'lib/protobuf/message/field.rb', line 251

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