Class: Class

Inherits:
Object
  • Object
show all
Defined in:
lib/eymiha/test/probe.rb

Instance Method Summary collapse

Instance Method Details

#privatize_public_instance_methods(methods) ⇒ Object

Take a list of instance methods and make any that are public private. Returns the list of methods that changed visibility.



33
34
35
36
37
38
# File 'lib/eymiha/test/probe.rb', line 33

def privatize_public_instance_methods(methods)
  target_methods = methods.select { |method|
    instance_methods.include? method.to_s }
  private(*target_methods) if target_methods.size > 0
  target_methods
end

#publicize_private_instance_methods(methods) ⇒ Object

Take a list of instance methods and make any that are private public. Returns the list of methods that changed visibility.



24
25
26
27
28
29
# File 'lib/eymiha/test/probe.rb', line 24

def publicize_private_instance_methods(methods)
  target_methods = methods.select { |method|
    private_instance_methods.include? method.to_s }
  public(*target_methods) if target_methods.size > 0
  target_methods
end