class Uncool::Unit

Attributes

function[R]
method[R]
target[R]

Public Class Methods

new(target, method, props={}) click to toggle source
# File lib/uncool/unit.rb, line 9
def initialize(target, method, props={})
  @target   = target
  @method   = method.to_sym
  @function = props[:function] ? true : false
  @covered  = props[:covered]

  if @function
    @private = !@target.public_methods.find{ |m| m.to_sym == @method }
  else
    @private = !@target.public_instance_methods.find{ |m| m.to_sym == @method }
  end
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/uncool/unit.rb, line 64
def <=>(other)
  c = (target.name <=> other.target.name)
  return c unless c == 0
  return -1 if function  && !other.function
  return  1 if !function && other.function
  method.to_s <=> other.method.to_s
end
covered?() click to toggle source

Marked as covered?

# File lib/uncool/unit.rb, line 28
def covered?
  @covered
end
eql?(other) click to toggle source
# File lib/uncool/unit.rb, line 52
def eql?(other)
  return false unless Unit === other
  return false unless target == other.target
  return false unless method == other.method
  return false unless function == other.function
  return true
end
function?() click to toggle source
# File lib/uncool/unit.rb, line 33
def function?
  @function
end
hash() click to toggle source
# File lib/uncool/unit.rb, line 38
def hash
  @target.hash ^ @method.hash ^ @function.hash
end
inspect() click to toggle source
# File lib/uncool/unit.rb, line 60
def inspect
  "#{target}#{function ? '.' : '#'}#{method}"
end
private?() click to toggle source

Method access is private or protected?

# File lib/uncool/unit.rb, line 23
def private?
  @private
end
to_s() click to toggle source
# File lib/uncool/unit.rb, line 43
def to_s
  if @function
    "#{@target}.#{@method}"
  else
    "#{@target}##{@method}"
  end
end
Also aliased as: to_str
to_str()
Alias for: to_s