Module: NewClass::ClassMethods::MethodMissing

Defined in:
lib/new_class.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



41
42
43
# File 'lib/new_class.rb', line 41

def method_missing(method, *args)
  _variables.include?(key = method.to_sym) ? define_method(key){ _variables[key] }.call : super
end

Instance Method Details

#respond_to?(symbol, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/new_class.rb', line 44

def respond_to?(symbol, include_private = false)
  _variables.include?(symbol.to_sym) || super
end