Module: AutoQuery

Defined in:
lib/docu_sign/extensions.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/docu_sign/extensions.rb', line 66

def method_missing(method_name, *args, &block)
  string_name = method_name.to_s

  if (string_name =~ /\?$/) && respond_to?(string_name.gsub(/\?/, ''))
    self.class.class_eval %Q{
      def #{string_name}(*args, &block)
        !! (send "#{string_name.gsub(/\?/, '')}", *args, &block)
      end
    }

    send method_name, *args, &block
  else
    super
  end
end