Class: RubyVolt::DataType
- Inherits:
-
Object
- Object
- RubyVolt::DataType
- Defined in:
- lib/ruby_volt/data_type.rb,
lib/ruby_volt/data_type/basic.rb,
lib/ruby_volt/data_type/complex.rb,
lib/ruby_volt/data_type/compound.rb,
lib/ruby_volt/data_type/extensions.rb,
lib/ruby_volt/data_type/basic/string.rb,
lib/ruby_volt/data_type/app_data_type.rb,
lib/ruby_volt/data_type/compound/array.rb,
lib/ruby_volt/data_type/basic/geography.rb,
lib/ruby_volt/data_type/basic/varbinary.rb,
lib/ruby_volt/data_type/basic/fixed_size.rb,
lib/ruby_volt/data_type/complex/parameter.rb,
lib/ruby_volt/data_type/complex/volt_table.rb,
lib/ruby_volt/data_type/basic/fixed_size/null.rb,
lib/ruby_volt/data_type/complex/parameter_set.rb,
lib/ruby_volt/data_type/basic/fixed_size/float.rb,
lib/ruby_volt/data_type/basic/fixed_size/decimal.rb,
lib/ruby_volt/data_type/basic/fixed_size/timestamp.rb,
lib/ruby_volt/data_type/app_data_type/wire_type_info.rb,
lib/ruby_volt/data_type/basic/fixed_size/integer_type.rb,
lib/ruby_volt/data_type/complex/serializable_exception.rb,
lib/ruby_volt/data_type/basic/fixed_size/geography_point.rb,
lib/ruby_volt/data_type/basic/fixed_size/integer_type/byte.rb,
lib/ruby_volt/data_type/basic/fixed_size/integer_type/long.rb,
lib/ruby_volt/data_type/basic/fixed_size/integer_type/short.rb,
lib/ruby_volt/data_type/basic/fixed_size/integer_type/u_byte.rb,
lib/ruby_volt/data_type/basic/fixed_size/integer_type/u_long.rb,
lib/ruby_volt/data_type/basic/fixed_size/integer_type/integer.rb,
lib/ruby_volt/data_type/basic/fixed_size/integer_type/u_short.rb,
lib/ruby_volt/data_type/basic/fixed_size/integer_type/u_integer.rb,
lib/ruby_volt/data_type/app_data_type/procedure_call_status_code.rb
Defined Under Namespace
Modules: Extensions Classes: AppDataType, Array, Basic, Byte, Complex, Compound, Decimal, FixedSize, Float, Geography, GeographyPoint, Integer, IntegerType, Long, Null, Parameter, ParameterSet, ProcedureCallStatusCode, SerializableException, Short, String, Timestamp, UByte, UInteger, ULong, UShort, Varbinary, VoltTable, WireTypeInfo
Class Method Summary collapse
- .classifyDataType(val) ⇒ Object
- .testpacking(*vals) ⇒ Object
-
.voltDataType(val) ⇒ Object
Ruby data type => Wire::DataType conversion.
Class Method Details
.classifyDataType(val) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ruby_volt/data_type.rb', line 26 def classifyDataType(val) case val when Class then val if val < DataType when ::String, ::Symbol then begin DataType.const_get(val) rescue nil end end end |
.testpacking(*vals) ⇒ Object
38 39 40 |
# File 'lib/ruby_volt/data_type.rb', line 38 def testpacking(*vals) unpack(ReadPartial.new(pack(*vals))) end |
.voltDataType(val) ⇒ Object
Ruby data type => Wire::DataType conversion
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ruby_volt/data_type.rb', line 4 def voltDataType(val) # Ruby data type => Wire::DataType conversion case val when ::Array then Array when NilClass then Null # Byte::NULL_INDICATOR when ::Integer then case val.bit_length when (0..7) then Byte when (8..15) then Short when (16..31) then Integer else Long if val.bit_length >= 32 end when ::Float then Float when ::String then val.encoding.name == "UTF-8" ? String : Varbinary # See "sometext".encoding when ::Time then Timestamp when ::BigDecimal then Decimal when Meta::Geography::Point then GeographyPoint when Meta::Geography::Polygon then Geography end end |