Class: Cardiac::ResourceReflection

Inherits:
BaseReflection show all
Defined in:
lib/cardiac/reflections.rb

Direct Known Subclasses

OperationReflection

Instance Attribute Summary collapse

Attributes inherited from BaseReflection

#http_verb, #macro, #options, #uri

Instance Method Summary collapse

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_klassObject (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_reflectionsObject (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_reflectionObject (readonly)

Returns the value of attribute encoder_reflection.



67
68
69
# File 'lib/cardiac/reflections.rb', line 67

def encoder_reflection
  @encoder_reflection
end