Class: Protobuf::Field::FieldArray
- Inherits:
-
Array
- Object
- Array
- Protobuf::Field::FieldArray
- Defined in:
- lib/protobuf/message/field.rb
Instance Method Summary collapse
- #<<(val) ⇒ Object
- #[]=(nth, val) ⇒ Object
-
#initialize(field) ⇒ FieldArray
constructor
A new instance of FieldArray.
- #push(val) ⇒ Object
- #replace(val) ⇒ Object
- #to_s ⇒ Object
- #unshift(val) ⇒ Object
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
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_s ⇒ Object
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 |