Class: Steep::Interface::Block

Inherits:
Object
  • Object
show all
Defined in:
lib/steep/interface/method_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params:, return_type:) ⇒ Block

Returns a new instance of Block.



185
186
187
188
# File 'lib/steep/interface/method_type.rb', line 185

def initialize(params:, return_type:)
  @params = params
  @return_type = return_type
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



182
183
184
# File 'lib/steep/interface/method_type.rb', line 182

def params
  @params
end

#return_typeObject (readonly)

Returns the value of attribute return_type.



183
184
185
# File 'lib/steep/interface/method_type.rb', line 183

def return_type
  @return_type
end

Instance Method Details

#==(other) ⇒ Object



190
191
192
# File 'lib/steep/interface/method_type.rb', line 190

def ==(other)
  other.is_a?(self.class) && other.params == params && other.return_type == return_type
end

#closed?Boolean

Returns:

  • (Boolean)


194
195
196
# File 'lib/steep/interface/method_type.rb', line 194

def closed?
  params.closed? && return_type.closed?
end

#free_variablesObject



205
206
207
# File 'lib/steep/interface/method_type.rb', line 205

def free_variables
  params.free_variables + return_type.free_variables
end

#subst(s) ⇒ Object



198
199
200
201
202
203
# File 'lib/steep/interface/method_type.rb', line 198

def subst(s)
  self.class.new(
    params: params.subst(s),
    return_type: return_type.subst(s)
  )
end

#to_sObject



209
210
211
# File 'lib/steep/interface/method_type.rb', line 209

def to_s
  "{ #{params} -> #{return_type} }"
end