Module CoreEx::Proc
In: lib/core_ex/proc.rb

Methods

Classes and Modules

Module CoreEx::Proc::ClassMethods
Class CoreEx::Proc::ArityError

Public Instance methods

[Source]

# File lib/core_ex/proc.rb, line 41
    def instance_call ( anObject, *args, &block )
      argc = args.size
      case arity
        when 1 + argc
          call(anObject, *args, &block)
        when argc, -1
          raise ArgumentError, "No block needed" if block
          anObject.instance_eval_with_args(*args, &self)
        else
          if arity < 0 and argc >= arity.abs - 2
            call(anObject, *args, &block)
          else
            raise ArityError
          end
      end
    end

[Source]

# File lib/core_ex/proc.rb, line 21
    def source_file
      to_s[/#<#{self.class}:.*@(.*):\d*>/, 1]
    end

[Source]

# File lib/core_ex/proc.rb, line 25
    def source_line
      to_s[/#<#{self.class}:.*@.*:(\d*)>/, 1].to_i
    end

[Source]

# File lib/core_ex/proc.rb, line 29
    def source_location
      to_s[/#<#{self.class}:.*@(.*:\d*)>/, 1]
    end

[Source]

# File lib/core_ex/proc.rb, line 37
    def to_proc
      self
    end

[Source]

# File lib/core_ex/proc.rb, line 33
    def to_yaml_string
      to_s
    end

[Validate]