class Unused::Reporters::Method

Attributes

calls[R]
id[R]
owner[R]
type[R]

Public Class Methods

new(id, owner, type, calls) click to toggle source
# File lib/unused/reporters/method.rb, line 8
def initialize(id, owner, type, calls)
  @id = id
  @owner = owner
  @type = type
  @calls = calls
end

Public Instance Methods

representation() click to toggle source
# File lib/unused/reporters/method.rb, line 15
def representation
  "#{@owner}#{representation_symbol}#{@id}"
end
source() click to toggle source
# File lib/unused/reporters/method.rb, line 19
def source
  file, line = source_location
  "#{file.sub(Unused.config.path, '')}:#{line}"
end

Private Instance Methods

representation_symbol() click to toggle source
# File lib/unused/reporters/method.rb, line 26
def representation_symbol
  @type == 'instance' ? '#' : '::'
end
source_location() click to toggle source
# File lib/unused/reporters/method.rb, line 30
def source_location
  if @type == 'instance'
    @owner.instance_method(@id).source_location
  else
    @owner.method(@id).source_location
  end
end