Class: Leadlight::Codec
- Inherits:
-
Object
- Object
- Leadlight::Codec
- Defined in:
- lib/leadlight/codec.rb
Class Method Summary collapse
Instance Method Summary collapse
- #decode(content_type, entity_body, options = {}) ⇒ Object
- #encode(content_type, representation, options = {}) ⇒ Object
Class Method Details
.strategies ⇒ Object
7 8 9 |
# File 'lib/leadlight/codec.rb', line 7 def self.strategies @strategies ||= [] end |
.strategy(name, encoder, decoder, patterns) ⇒ Object
11 12 13 |
# File 'lib/leadlight/codec.rb', line 11 def self.strategy(name, encoder, decoder, patterns) strategies << Strategy.new(name, encoder, decoder, Array(patterns)) end |
Instance Method Details
#decode(content_type, entity_body, options = {}) ⇒ Object
27 28 29 |
# File 'lib/leadlight/codec.rb', line 27 def decode(content_type, entity_body, ={}) transcode(:decode, content_type, entity_body, ) end |
#encode(content_type, representation, options = {}) ⇒ Object
31 32 33 |
# File 'lib/leadlight/codec.rb', line 31 def encode(content_type, representation, ={}) transcode(:encode, content_type, representation, ) end |