Sha256: 877639a883e55202938ed457bbf56c1e64279dc60f41f2c550e4a14a037eb576

Contents?: true

Size: 517 Bytes

Versions: 1

Compression:

Stored size: 517 Bytes

Contents

Module.class_eval do
  def dup_including(*methods)
    dup.class_eval do
      aliased = (methods.last.is_a? Hash) ? methods.last : {}
      aliased.each{ |from, to| alias_method to, from }

      to_be_kept_methods = methods + aliased.values
      (all_instance_methods - to_be_kept_methods).each{ |m| remove_method m }

      self
    end
  end

  def all_instance_methods
    private_methods = (respond_to? :private_instance_methods) ? private_instance_methods : []
    instance_methods + private_methods
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pipe_rpc-2.4.0 lib/pipe_rpc/_pipe_rpc.rb