Class: Parlour::Types::Intersection
Overview
A type which matches all of the wrapped types.
Instance Attribute Summary collapse
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #describe ⇒ Object
- #generate_rbi ⇒ Object
- #generate_rbs ⇒ Object
-
#initialize(types) ⇒ Intersection
constructor
A new instance of Intersection.
Methods inherited from Type
Constructor Details
#initialize(types) ⇒ Intersection
Returns a new instance of Intersection.
140 141 142 |
# File 'lib/parlour/types.rb', line 140 def initialize(types) @types = types.map(&method(:to_type)) end |
Instance Attribute Details
#types ⇒ Object (readonly)
Returns the value of attribute types.
150 151 152 |
# File 'lib/parlour/types.rb', line 150 def types @types end |
Instance Method Details
#==(other) ⇒ Object
145 146 147 |
# File 'lib/parlour/types.rb', line 145 def ==(other) Intersection === other && types == other.types end |
#describe ⇒ Object
163 164 165 |
# File 'lib/parlour/types.rb', line 163 def describe "Intersection<#{types.map(&:describe).join(', ')}>" end |
#generate_rbi ⇒ Object
153 154 155 |
# File 'lib/parlour/types.rb', line 153 def generate_rbi "T.all(#{types.map(&:generate_rbi).join(', ')})" end |
#generate_rbs ⇒ Object
158 159 160 |
# File 'lib/parlour/types.rb', line 158 def generate_rbs "(#{types.map(&:generate_rbs).join(' & ')})" end |