Module: Protip::Converter

Extended by:
ActiveSupport::Concern
Included in:
StandardConverter
Defined in:
lib/protip/converter.rb

Instance Method Summary collapse

Instance Method Details

#convertible?(message_class) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


8
9
10
11
12
# File 'lib/protip/converter.rb', line 8

def convertible?(message_class)
  raise NotImplementedError.new(
    'Must specify whether a message of a given type can be converted to/from a Ruby object'
  )
end

#to_message(object, message_class) ⇒ Object

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/protip/converter.rb', line 18

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

#to_object(message) ⇒ Object

Raises:

  • (NotImplementedError)


14
15
16
# File 'lib/protip/converter.rb', line 14

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