Class: Farscape::RepresentorAgent

Inherits:
SafeRepresentorAgent show all
Defined in:
lib/farscape/representor.rb

Constant Summary

Constants inherited from SafeRepresentorAgent

SafeRepresentorAgent::EMPTY_BODIES

Instance Attribute Summary

Attributes inherited from SafeRepresentorAgent

#agent, #representor, #response

Instance Method Summary collapse

Methods inherited from SafeRepresentorAgent

#attributes, #embedded, #initialize, #safe, #to_hash, #transitions, #unsafe

Methods included from BaseAgent

#handle_extensions

Constructor Details

This class inherits a constructor from Farscape::SafeRepresentorAgent

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



74
75
76
77
78
79
# File 'lib/farscape/representor.rb', line 74

def method_missing(method, *args, &block)
  super
rescue NoMethodError => e
  parameters = args.first || {}
  get_embedded(method) || get_transition(method, parameters, &block) || get_attribute(method) || raise
end

Instance Method Details

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/farscape/representor.rb', line 81

def respond_to_missing?(method_name, include_private = false)
  super || [embedded.include?(method_name), method_transitions.include?(method), attributes.include?(method)].any?
end

#to_aryObject

HACK! - Requires for method_missing; apparently an undocumented feature of Ruby



86
87
# File 'lib/farscape/representor.rb', line 86

def to_ary
end