module MetaRuby::DSLs::FindThroughMethodMissing
Common definition of respond_to_missing?
and method_missing
to be used in conjunction with {DSLs.find_through_method_missing} and {DSLs.has_through_method_missing?}
@example resolve 'event' objects using method_missing
class Task # Tests if this task has an event by this name # # @param [String] name # @return [Boolean] def has_event?(name) end # Finds an event by name # # @param [String] name # @return [Object,nil] the found event, or nil if there is no # event by this name def find_event(name) end include MetaRuby::DSLs::FindThroughMethodMissing # Check if the given method matches a find object def has_through_method_missing?(m) MetaRuby::DSLs.has_through_method_missing?( self, m, '_event' => :has_event?) || super end # Check if the given method matches a find object def find_through_method_missing(m, args) MetaRuby::DSLs.find_through_method_missing( self, m, args, '_event' => :find_event) || super end end
Public Instance Methods
find_through_method_missing(m, args)
click to toggle source
Empty implementation of find_through_method_missing
to allow for classes to call 'super'
# File lib/metaruby/dsls/find_through_method_missing.rb, line 49 def find_through_method_missing(m, args) end
has_through_method_missing?(m)
click to toggle source
Empty implementation of has_through_method_missing? to allow for classes to call 'super'
# File lib/metaruby/dsls/find_through_method_missing.rb, line 44 def has_through_method_missing?(m) end
method_missing(m, *args)
click to toggle source
Resolves the given method using {#find_through_method_missing}
Calls superclass method
# File lib/metaruby/dsls/find_through_method_missing.rb, line 58 def method_missing(m, *args) find_through_method_missing(m, args) || super end
respond_to_missing?(m, include_private)
click to toggle source
Resolves the given method using {#has_through_method_missing?}
Calls superclass method
# File lib/metaruby/dsls/find_through_method_missing.rb, line 53 def respond_to_missing?(m, include_private) has_through_method_missing?(m) || super end