Module: Protip::Transformer

Overview

Interface for an object that converts between messages and more complex Ruby types. Resources and wrapped messages store one of these to transparently allow getting/setting of message fields as if they were Ruby types.

Instance Method Summary collapse

Instance Method Details

#to_message(object, field) ⇒ Object

Raises:

  • (NotImplementedError)


10
11
12
# File 'lib/protip/transformer.rb', line 10

def to_message(object, field)
  raise NotImplementedError.new('Must convert a Ruby object into a message of the given type')
end

#to_object(message, field) ⇒ Object

Raises:

  • (NotImplementedError)


6
7
8
# File 'lib/protip/transformer.rb', line 6

def to_object(message, field)
  raise NotImplementedError.new('Must convert a message into a Ruby object')
end