Module: Cardiac::CodecMethods
- Included in:
- Resource
- Defined in:
- lib/cardiac/resource/codec_methods.rb
Constant Summary collapse
- DEFAULT_DECODERS =
[:url_encoded, :xml, :json].freeze
Instance Method Summary collapse
-
#decoders(search, *rest, &handler) ⇒ Object
Representation decoder selection and customization.
-
#encoder(search, &handler) ⇒ Object
Representation encoder selection and customization.
- #reset_decoders(*rest, &handler) ⇒ Object
Instance Method Details
#decoders(search, *rest, &handler) ⇒ Object
Representation decoder selection and customization.
6 |
# File 'lib/cardiac/resource/codec_methods.rb', line 6 def decoders(search,*rest,&handler) self.decoders_values += check_decoders(rest.unshift(search),handler) ; self end |
#encoder(search, &handler) ⇒ Object
Representation encoder selection and customization.
10 11 12 13 14 |
# File 'lib/cardiac/resource/codec_methods.rb', line 10 def encoder(search, &handler) self.encoder_search_value = search.presence or raise ArgumentError self.encoder_handler_value = handler self end |
#reset_decoders(*rest, &handler) ⇒ Object
7 |
# File 'lib/cardiac/resource/codec_methods.rb', line 7 def reset_decoders(*rest,&handler) decoders_values.replace check_decoders(rest,handler) ; self end |