Class: Cardiac::ResourceReflection
- Inherits:
-
BaseReflection
- Object
- BaseReflection
- Cardiac::ResourceReflection
- Defined in:
- lib/cardiac/reflections.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#adapter_klass ⇒ Object
readonly
Returns the value of attribute adapter_klass.
-
#decoder_reflections ⇒ Object
readonly
Returns the value of attribute decoder_reflections.
-
#encoder_reflection ⇒ Object
readonly
Returns the value of attribute encoder_reflection.
Attributes inherited from BaseReflection
#http_verb, #macro, #options, #uri
Instance Method Summary collapse
-
#initialize(resource, http_verb = nil) ⇒ ResourceReflection
constructor
A new instance of ResourceReflection.
Methods inherited from BaseReflection
#to_reflection, #to_uri, #to_url
Constructor Details
#initialize(resource, http_verb = nil) ⇒ ResourceReflection
Returns a new instance of ResourceReflection.
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/cardiac/reflections.rb', line 69 def initialize(resource, http_verb=nil) super resource, http_verb @decoder_reflections = resource.send(:build_decoders).map do |search,handler_chain| ChainReflection.new :decode, Representation::Reflection.new(search), *handler_chain end @encoder_reflection = ChainReflection.new :encode, *(resource.send(:build_encoder).tap do |search_and_chain| search_and_chain[0] = Representation::Reflection.new(search_and_chain.first || :url_encoded) end) end |
Instance Attribute Details
#adapter_klass ⇒ Object (readonly)
Returns the value of attribute adapter_klass.
67 68 69 |
# File 'lib/cardiac/reflections.rb', line 67 def adapter_klass @adapter_klass end |
#decoder_reflections ⇒ Object (readonly)
Returns the value of attribute decoder_reflections.
67 68 69 |
# File 'lib/cardiac/reflections.rb', line 67 def decoder_reflections @decoder_reflections end |
#encoder_reflection ⇒ Object (readonly)
Returns the value of attribute encoder_reflection.
67 68 69 |
# File 'lib/cardiac/reflections.rb', line 67 def encoder_reflection @encoder_reflection end |