class Thrift::Types::Value::StructValue
Constants
- FIELDS
- NAME
- NAMESPACE
- THRIFT_FIELD_INDEX_FIELDS
Public Class Methods
from_object(v)
click to toggle source
# File lib/thrift/types/value.rb 49 def from_object(v) 50 StructValue.new( 51 fields: v.instance_variables.reduce({}) do |acc, k| 52 acc.merge( 53 k.to_s[1..-1] => Value.from_object(v.instance_variable_get(k)) 54 ) 55 end 56 ) 57 end
Public Instance Methods
struct_fields()
click to toggle source
# File lib/thrift/types/value_types.rb 125 def struct_fields; FIELDS; end
to_hash()
click to toggle source
# File lib/thrift/types/value.rb 42 def to_hash 43 fields.reduce({}) do |acc, (k, v)| 44 acc.merge(k => v.to_object) 45 end 46 end
validate()
click to toggle source
# File lib/thrift/types/value_types.rb 127 def validate 128 raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field fields is unset!') unless @fields 129 end