Class: Steep::Interface::Function::Params::PositionalParams::Base
- Defined in:
- lib/steep/interface/function.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(type) ⇒ Base
constructor
A new instance of Base.
- #map_type(&block) ⇒ Object
- #subst(s) ⇒ Object
- #var_type ⇒ Object
Constructor Details
#initialize(type) ⇒ Base
Returns a new instance of Base.
20 21 22 |
# File 'lib/steep/interface/function.rb', line 20 def initialize(type) @type = type end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
18 19 20 |
# File 'lib/steep/interface/function.rb', line 18 def type @type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
24 25 26 |
# File 'lib/steep/interface/function.rb', line 24 def ==(other) other.is_a?(self.class) && other.type == type end |
#hash ⇒ Object
30 31 32 |
# File 'lib/steep/interface/function.rb', line 30 def hash self.class.hash ^ type.hash end |
#map_type(&block) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/steep/interface/function.rb', line 48 def map_type(&block) if block_given? _ = self.class.new(yield type) else enum_for(:map_type) end end |
#subst(s) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/steep/interface/function.rb', line 34 def subst(s) ty = type.subst(s) if ty == type self else _ = self.class.new(ty) end end |
#var_type ⇒ Object
44 45 46 |
# File 'lib/steep/interface/function.rb', line 44 def var_type type end |