Module: Packet::Entity::Serialization
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/packet/entity/serialization.rb
Instance Method Summary collapse
- #to_hash ⇒ Object (also: #to_h)
Instance Method Details
#to_hash ⇒ Object Also known as: to_h
16 17 18 19 20 21 |
# File 'lib/packet/entity/serialization.rb', line 16 def to_hash instance_variables.reject { |ivar| [:@client].include?(ivar) }.map do |ivar| ival = instance_variable_get(ivar) [ivar.to_s.tr('@', ''), ival.respond_to?(:to_value) ? ival.to_value : instance_variable_get(ivar)] end.to_h end |