Module: TypeSwitcher

Defined in:
lib/grpc/orin3/provider.rb

Class Method Summary collapse

Class Method Details

.execute(type, branch) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/grpc/orin3/provider.rb', line 45

def self.execute(type, branch)
  case type
  when ORiN3ValueType::ORiN3Bool
    branch.case_of_bool
  when ORiN3ValueType::ORiN3BoolArray
    branch.case_of_bool_array
  when ORiN3ValueType::ORiN3NullableBool
    branch.case_of_nullable_bool
  when ORiN3ValueType::ORiN3NullableBoolArray
    branch.case_of_nullable_bool_array
  when ORiN3ValueType::ORiN3Int8
    branch.case_of_int8
  when ORiN3ValueType::ORiN3Int8Array
    branch.case_of_int8_array
  when ORiN3ValueType::ORiN3NullableInt8
    branch.case_of_nullable_int8
  when ORiN3ValueType::ORiN3NullableInt8Array
    branch.case_of_nullable_int8_array
  when ORiN3ValueType::ORiN3Int16
    branch.case_of_int16
  when ORiN3ValueType::ORiN3Int16Array
    branch.case_of_int16_array
  when ORiN3ValueType::ORiN3NullableInt16
    branch.case_of_nullable_int16
  when ORiN3ValueType::ORiN3NullableInt16Array
    branch.case_of_nullable_int16_array
  when ORiN3ValueType::ORiN3Int32
    branch.case_of_int32
  when ORiN3ValueType::ORiN3Int32Array
    branch.case_of_int32_array
  when ORiN3ValueType::RiN3NullableInt32
    branch.case_of_nullable_int32
  when ORiN3ValueType::ORiN3NullableInt32Array
    branch.case_of_nullable_int32_array
  when ORiN3ValueType::ORiN3Int64
    branch.case_of_int64
  when ORiN3ValueType::ORiN3Int64Array
    branch.case_of_int64_array
  when ORiN3ValueType::ORiN3NullableInt64
    branch.case_of_nullable_int64
  when ORiN3ValueType::ORiN3NullableInt64Array
    branch.case_of_nullable_int64_array
  when ORiN3ValueType::ORiN3UInt8
    branch.case_of_uint8
  when ORiN3ValueType::ORiN3UInt8Array
    branch.case_of_uint8_array
  when ORiN3ValueType::ORiN3NullableUInt8
    branch.case_of_nullable_uint8
  when ORiN3ValueType::ORiN3NullableUInt8Array
    branch.case_of_nullable_uint8_array
  when ORiN3ValueType::ORiN3UInt16
    baanch.case_of_uint16
  when ORiN3ValueType::ORiN3UInt16Array
    branch.case_of_uint16_array
  when ORiN3ValueType::ORiN3NullableUInt16
    branch.case_of_nullable_uint16
  when ORiN3ValueType::ORiN3NullableUInt16Array
    branch.case_of_nullable_uint16_array    
  when ORiN3ValueType::ORiN3UInt32
    branch.case_of_uint32
  when ORiN3ValueType::ORiN3UInt32Array
    branch.case_of_uint32_array
  when ORiN3ValueType::ORiN3NullableUInt32
    branch.case_of_nullable_uint32
  when ORiN3ValueType::ORiN3NullableUInt32Array
    branch.case_of_nullable_uint32_array
  when ORiN3ValueType::ORiN3UInt64
    branch.case_of_uint64
  when ORiN3ValueType::ORiN3UInt64Array
    branch.case_of_uint64_array
  when ORiN3ValueType::ORiN3NullableUInt64
    branch.case_of_nullable_uint64
  when ORiN3ValueType::ORiN3NullableUInt64Array
    branch.case_of_nullable_uint64_array
  when ORiN3ValueType::ORiN3Float
    branch.case_of_float
  when ORiN3ValueType::ORiN3FloatArray
    branch.case_of_float_array
  when ORiN3ValueType::ORiN3NullableFloat
    branch.case_of_nullable_float
  when ORiN3ValueType::ORiN3NullableFloatArray
    branch.case_of_nullable_float_array
  when ORiN3ValueType::ORiN3Double
    branch.case_of_double
  when ORiN3ValueType::ORiN3DoubleArray
    baanch.case_of_double_array
  when ORiN3ValueType::ORiN3NullableDouble
    branch.case_of_nullable_double
  when ORiN3ValueType::ORiN3NullableDoubleArray
    branch.case_of_nullable_double_array
  when ORiN3ValueType::ORiN3String
    branch.case_of_string
  when ORiN3ValueType::ORiN3StringArray
    branch.case_of_string_array
  when ORiN3ValueType::ORiN3DateTime
    branch.case_of_datetime
  when ORiN3ValueType::ORiN3DateTimeArray
    branch.case_of_datetime_array
  when ORiN3ValueType::ORiN3NullableDateTime
    branch.case_of_nullable_datetime
  when ORiN3ValueType::ORiN3NullableDateTimeArray
    branch.case_of_nullable_datetime_array
  when ORiN3ValueType::ORiN3Object
    branch.case_of_object
  else
    branch.case_of_error
  end
rescue => e
  raise TypeSwitcherException.new(type, e)
end