Class: FCC::Station::ResultDelegate
- Inherits:
-
Object
- Object
- FCC::Station::ResultDelegate
- Defined in:
- lib/fcc/station/result_delegate.rb
Instance Method Summary collapse
-
#initialize(result) ⇒ ResultDelegate
constructor
A new instance of ResultDelegate.
- #method_missing(m, *args, &block) ⇒ Object
Constructor Details
#initialize(result) ⇒ ResultDelegate
Returns a new instance of ResultDelegate.
7 8 9 |
# File 'lib/fcc/station/result_delegate.rb', line 7 def initialize(result) @result = result end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fcc/station/result_delegate.rb', line 11 def method_missing(m, *args, &block) if @result matched_key = @result.keys.detect { |d| m.to_s == d.to_s } || @result.keys.detect { |d| m.to_s == d.underscore.to_s } if matched_key @result[matched_key] else super end end end |