Class: Bringhurst::TypeSignature

Inherits:
Object
  • Object
show all
Defined in:
lib/bringhurst/type_signature.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass:, method:, method_kind:, arguments:, result:) ⇒ TypeSignature

Returns a new instance of TypeSignature.



5
6
7
8
9
10
11
# 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

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



3
4
5
# File 'lib/bringhurst/type_signature.rb', line 3

def arguments
  @arguments
end

#klassObject (readonly)

Returns the value of attribute klass.



3
4
5
# File 'lib/bringhurst/type_signature.rb', line 3

def klass
  @klass
end

#methodObject (readonly)

Returns the value of attribute method.



3
4
5
# File 'lib/bringhurst/type_signature.rb', line 3

def method
  @method
end

#method_kindObject (readonly)

Returns the value of attribute method_kind.



3
4
5
# File 'lib/bringhurst/type_signature.rb', line 3

def method_kind
  @method_kind
end

#resultObject (readonly)

Returns the value of attribute result.



3
4
5
# File 'lib/bringhurst/type_signature.rb', line 3

def result
  @result
end

Instance Method Details

#==(other) ⇒ Object



13
14
15
16
17
18
19
20
# 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_sObject



22
23
24
# File 'lib/bringhurst/type_signature.rb', line 22

def to_s
  "#{ method_name }: #{ (arguments + [result]).map(&:to_s).join(" -> ") }"
end