Module: AttrPrivate::SingletonMethods::ClassMethods

Defined in:
lib/attr_private.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missingObject Also known as: method_missing_without_parameter_exclusion



57
58
59
60
61
62
# File 'lib/attr_private.rb', line 57

def method_missing_with_parameter_exclusion(name, *args)
  private_fields.each do |field|
    raise ::NoMethodError, "undefined method `#{name}' for #{self}" if /_#{field}_|_#{field}$/.match(name.to_s)
  end
  method_missing_without_parameter_exclusion(name, args) 
end

Instance Method Details

#method_missing_with_parameter_exclusion(name, *args) ⇒ Object Also known as: method_missing



49
50
51
52
53
54
# File 'lib/attr_private.rb', line 49

def method_missing_with_parameter_exclusion(name, *args)
  private_fields.each do |field|
    raise ::NoMethodError, "undefined method `#{name}' for #{self}" if /_#{field}_|_#{field}$/.match(name.to_s)
  end
  method_missing_without_parameter_exclusion(name, args) 
end