Class: ActiveAsari::ResultObject
- Inherits:
-
Object
- Object
- ActiveAsari::ResultObject
- Defined in:
- lib/active_asari/result_object.rb
Instance Attribute Summary collapse
-
#raw_result ⇒ Object
Returns the value of attribute raw_result.
Instance Method Summary collapse
- #method_missing(method_sym, *arguments, &block) ⇒ Object
- #respond_to?(method_sym, include_private = false) ⇒ Boolean
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_sym, *arguments, &block) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/active_asari/result_object.rb', line 4 def method_missing(method_sym, *arguments, &block) base_method = method_sym.to_s.end_with?('_array') ? method_sym.to_s.chomp('_array') : method_sym.to_s if raw_result.has_key? base_method method_sym.to_s.end_with?('_array') ? raw_result[base_method] : raw_result[base_method].first else super end end |
Instance Attribute Details
#raw_result ⇒ Object
Returns the value of attribute raw_result.
2 3 4 |
# File 'lib/active_asari/result_object.rb', line 2 def raw_result @raw_result end |
Instance Method Details
#respond_to?(method_sym, include_private = false) ⇒ Boolean
13 14 15 16 17 18 19 20 |
# File 'lib/active_asari/result_object.rb', line 13 def respond_to?(method_sym, include_private = false) base_method = method_sym.to_s.end_with?('_array') ? method_sym.to_s.chomp('_array') : method_sym.to_s if raw_result.has_key? base_method true else super end end |