Class: Helpers::Properties::MethodMissingRedirector

Inherits:
Object
  • Object
show all
Defined in:
lib/dav4rack_ext/helpers/properties.rb

Instance Method Summary collapse

Constructor Details

#initialize(*methods, &block) ⇒ MethodMissingRedirector

Returns a new instance of MethodMissingRedirector.



4
5
6
7
# File 'lib/dav4rack_ext/helpers/properties.rb', line 4

def initialize(*methods, &block)
  @block = block
  @methods = methods
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



9
10
11
12
13
# File 'lib/dav4rack_ext/helpers/properties.rb', line 9

def method_missing(name, *args, &block)
  if @methods.empty? || @methods.include?(name)
    @block.call(name, *args, &block)
  end
end