Sha256: d1cd1ebf48f7d0d17f72ff92257895741d364ded8d327bc6f4b87f58dcbe5ab9

Contents?: true

Size: 673 Bytes

Versions: 2

Compression:

Stored size: 673 Bytes

Contents

class Array
  # HACK:
  # When we define private/protected/public methods, we usually use
  # Module#private, Module#protected & Module#public methods to set the
  # access of that method.
  # But in cases where we define methods not within a class
  # definition, this fails. To make it work, we define these. Kinda
  # stupid, i know, but oh well. Maybe need to fix this in the future.
  def public
    puts self.inspect
    Rubinius::VariableScope.of_sender.method_visibility = nil
  end
  def private
    Rubinius::VariableScope.of_sender.method_visibility = :private
  end
  def protected
    Rubinius::VariableScope.of_sender.method_visibility = :protected
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fancy-0.9.0 boot/fancy_ext/array.rb
fancy-0.8.0 boot/fancy_ext/array.rb