Sha256: 6e64ac61e358e5443b6648a2812c16338ccee1906a911ce8e8f39ffb9233aa47

Contents?: true

Size: 532 Bytes

Versions: 1

Compression:

Stored size: 532 Bytes

Contents

module Forewarn
  module Values
    class Method
      attr_reader :warner, :method

      def initialize(warner = nil, method = nil)
        @warner = warner
        @method = method
      end

      def instance_method?
        !@method.owner.singleton_class?
      end

      def name
        @method.to_s[/:\s*(.*)>/, 1]
      end

      def bind(new_owner)
        if @method.respond_to?(:unbind)
          @method.unbind.bind(new_owner)
        else
          @method.bind(new_owner)
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
forewarn-0.1.0 lib/forewarn/values/method.rb