Class: Spectro::Spec::Signature

Inherits:
Object
  • Object
show all
Defined in:
lib/spectro/spec/signature.rb

Overview

Representation of the required input/output types

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, params_types, output_type) ⇒ Signature

Returns a new instance of Signature.

Parameters:

  • name (String)

    local name of the algorith (not sure if needed)

  • param_types (<String>)

    types of the expected input params

  • output_type (String)

    type of the expected output



13
14
15
16
17
# File 'lib/spectro/spec/signature.rb', line 13

def initialize name, params_types, output_type
  self.name = name
  self.output_type = output_type
  self.params_types = params_types
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/spectro/spec/signature.rb', line 8

def name
  @name
end

#output_typeObject

Returns the value of attribute output_type.



8
9
10
# File 'lib/spectro/spec/signature.rb', line 8

def output_type
  @output_type
end

#params_typesObject

Returns the value of attribute params_types.



8
9
10
# File 'lib/spectro/spec/signature.rb', line 8

def params_types
  @params_types
end

Instance Method Details

#==(signature) ⇒ Object



19
20
21
22
23
24
# File 'lib/spectro/spec/signature.rb', line 19

def == signature
  return \
    self.name == signature.name && \
    self.output_type == signature.output_type && \
    self.params_types == signature.params_types
end

#to_hashObject



26
27
28
29
30
31
32
# File 'lib/spectro/spec/signature.rb', line 26

def to_hash
  return {
    name: self.name,
    output_type: self.output_type,
    params_type: self.params_types
  }
end