Method: FlatMap::OpenMapper::Mounting#method_missing
- Defined in:
- lib/flat_map/open_mapper/mounting.rb
#method_missing(name, *args, &block) ⇒ Object
Delegate missing method to any mounted mapping that respond to it, unless those methods are protected methods of FlatMap::OpenMapper.
NOTE: :to_ary method is called internally by Ruby 1.9.3 when we call something like [mapper].flatten. And we DO want default behavior for handling this missing method.
157 158 159 160 161 162 163 164 165 166 |
# File 'lib/flat_map/open_mapper/mounting.rb', line 157 def method_missing(name, *args, &block) return super if name == :to_ary || self.class.protected_instance_methods.include?(name) return self[name] if mapping(name).present? mounting = all_mountings.find{ |mount| mount.respond_to?(name) } return super if mounting.nil? mounting.send(name, *args, &block) end |