Class: ProtocolBuffers::Field::NumericField
Instance Attribute Summary
#name, #otype, #tag
Instance Method Summary
collapse
#add_methods_to, #check_valid, create, #deserialize, #inspect_value, #repeated?, #serialize, #valid_type?
Instance Method Details
#check_value(value) ⇒ Object
277
278
279
|
# File 'lib/protocol_buffers/runtime/field.rb', line 277
def check_value(value)
raise(ArgumentError, "value is out of range for type #{self.class.name}: #{value}") unless value >= min && value <= max
end
|
#default_value ⇒ Object
281
282
283
|
# File 'lib/protocol_buffers/runtime/field.rb', line 281
def default_value
@opts[:default] || 0
end
|
#max ⇒ Object
273
274
275
|
# File 'lib/protocol_buffers/runtime/field.rb', line 273
def max
1.0 / 0.0
end
|
#min ⇒ Object
269
270
271
|
# File 'lib/protocol_buffers/runtime/field.rb', line 269
def min
0
end
|