class Bringhurst::TypeSignature

Attributes

arguments[R]
klass[R]
method[R]
method_kind[R]
result[R]

Public Class Methods

new(klass:, method:, method_kind:, arguments:, result:) click to toggle source
# File lib/bringhurst/type_signature.rb, line 5
def initialize(klass:, method:, method_kind:, arguments:, result:)
  @klass = klass
  @method = method
  @method_kind = method_kind
  @arguments = arguments
  @result = result
end

Public Instance Methods

==(other) click to toggle source
# File lib/bringhurst/type_signature.rb, line 13
def ==(other)
  self.class == other.class &&
    klass == other.klass &&
    method == other.method &&
    method_kind == other.method_kind &&
    arguments == other.arguments &&
    result == other.result
end
to_s() click to toggle source
# File lib/bringhurst/type_signature.rb, line 22
def to_s
  "#{ method_name }: #{ (arguments + [result]).map(&:to_s).join(" -> ") }"
end

Private Instance Methods

method_name() click to toggle source
# File lib/bringhurst/type_signature.rb, line 28
def method_name
  if method_kind == :instance
    "#{ klass }##{ method }"
  elsif method_kind == :class
    "#{ klass }.#{ method }"
  end
end