Module: Protip::Transformer
- Included in:
- Protip::Transformers::AbstractTransformer, Protip::Transformers::ActiveSupport::TimeWithZoneTransformer, Protip::Transformers::DecoratingTransformer, Protip::Transformers::DelegatingTransformer, Protip::Transformers::DeprecatedTransformer::CurrencyTransformer, Protip::Transformers::DeprecatedTransformer::DateTransformer, Protip::Transformers::DeprecatedTransformer::MoneyTransformer, Protip::Transformers::DeprecatedTransformer::RangeTransformer, Protip::Transformers::DeprecatedTransformer::TimeWithZoneTransformer
- Defined in:
- lib/protip/transformer.rb
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
10 11 12 |
# File 'lib/protip/transformer.rb', line 10 def (object, field) raise NotImplementedError.new('Must convert a Ruby object into a message of the given type') end |
#to_object(message, field) ⇒ Object
6 7 8 |
# File 'lib/protip/transformer.rb', line 6 def to_object(, field) raise NotImplementedError.new('Must convert a message into a Ruby object') end |