Class: MilkTea::Types::Parameter

Inherits:
Object
  • Object
show all
Defined in:
lib/milk_tea/core/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type, mutable: false, passing_mode: :plain, boundary_type: nil) ⇒ Parameter

Returns a new instance of Parameter.



1283
1284
1285
1286
1287
1288
1289
1290
1291
# File 'lib/milk_tea/core/types.rb', line 1283

def initialize(name, type, mutable: false, passing_mode: :plain, boundary_type: nil)
  @name = name
  @type = type
  @mutable = mutable
  @passing_mode = passing_mode
  @boundary_type = boundary_type
  @hash = [self.class, type, mutable, passing_mode, boundary_type].hash
  freeze
end

Instance Attribute Details

#boundary_typeObject (readonly)

Returns the value of attribute boundary_type.



1281
1282
1283
# File 'lib/milk_tea/core/types.rb', line 1281

def boundary_type
  @boundary_type
end

#hashObject (readonly)

Returns the value of attribute hash.



1307
1308
1309
# File 'lib/milk_tea/core/types.rb', line 1307

def hash
  @hash
end

#mutableObject (readonly)

Returns the value of attribute mutable.



1281
1282
1283
# File 'lib/milk_tea/core/types.rb', line 1281

def mutable
  @mutable
end

#nameObject (readonly)

Returns the value of attribute name.



1281
1282
1283
# File 'lib/milk_tea/core/types.rb', line 1281

def name
  @name
end

#passing_modeObject (readonly)

Returns the value of attribute passing_mode.



1281
1282
1283
# File 'lib/milk_tea/core/types.rb', line 1281

def passing_mode
  @passing_mode
end

#typeObject (readonly)

Returns the value of attribute type.



1281
1282
1283
# File 'lib/milk_tea/core/types.rb', line 1281

def type
  @type
end

Instance Method Details

#childrenObject



1309
1310
1311
# File 'lib/milk_tea/core/types.rb', line 1309

def children
  [type, boundary_type].compact
end

#eql?(other) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


1297
1298
1299
1300
1301
1302
1303
# File 'lib/milk_tea/core/types.rb', line 1297

def eql?(other)
  other.is_a?(Parameter) &&
    other.type == type &&
    other.mutable == mutable &&
    other.passing_mode == passing_mode &&
    other.boundary_type == boundary_type
end

#to_sObject



1293
1294
1295
# File 'lib/milk_tea/core/types.rb', line 1293

def to_s
  "#{name}: #{type}"
end