Class: Parlour::Types::Proc::Parameter

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/parlour/types.rb

Overview

A parameter to a proc.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type, default = nil) ⇒ Parameter

Returns a new instance of Parameter.



510
511
512
513
514
# File 'lib/parlour/types.rb', line 510

def initialize(name, type, default = nil)
  @name = name
  @type = Type.to_type(type)
  @default = default
end

Instance Attribute Details

#defaultObject (readonly)

Returns the value of attribute default.



523
524
525
# File 'lib/parlour/types.rb', line 523

def default
  @default
end

#nameObject (readonly)

Returns the value of attribute name.



517
518
519
# File 'lib/parlour/types.rb', line 517

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



520
521
522
# File 'lib/parlour/types.rb', line 520

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



526
527
528
529
# File 'lib/parlour/types.rb', line 526

def ==(other)
  Parameter === other && name == other.name && type == other.type &&
    default == other.default
end