Sha256: 7febee78b9b86095051b07ca9c4b2f4ceebb29ecdfc0633e7be3477935cbd9a0

Contents?: true

Size: 380 Bytes

Versions: 8

Compression:

Stored size: 380 Bytes

Contents

require 'mpatch'

class Test

  def say
    "hello world"
  end

  def sup
    "fine thx"
  end

  privatize t: :instance, ex: 'sup'

end

test1= Test.new

puts test1.sup #> fine thx

puts try{ test1.say } #> will fail and say error instead "hello world"
puts test1.__send__ :say #> hello world

test1.privatize only: 'sup'
puts try{ test1.sup } #> fail again because it's private

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mpatch-2.12.2 examples/privatize.rb
mpatch-2.12.1 examples/privatize.rb
mpatch-2.12.0 examples/privatize.rb
mpatch-2.11.0 examples/privatize.rb
mpatch-2.9.0 examples/privatize.rb
mpatch-2.8.1 examples/privatize.rb
mpatch-2.8.0 examples/privatize.rb
mpatch-2.7.0 examples/privatize.rb