Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

how to call ruby private methods

class Sample
  private
  def baz
    'baz called'
  end
end

Sample.new.instance_eval('baz')
# => 'baz called'
Sample.new.instance_eval { baz }
# => 'baz called
How to call private methods
 
PREVIOUS NEXT
Tagged: #call #ruby #private #methods
ADD COMMENT
Topic
Name
8+7 =