Answers for "how to call ruby private methods"

1

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
Posted by: Guest on May-28-2021

Browse Popular Code Answers by Language