Class: Parlour::Types::SingleElementCollection

Inherits:
Type
  • Object
show all
Defined in:
lib/parlour/types.rb

Direct Known Subclasses

Array, Enumerable, Enumerator, Range, Set

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Type

#hash, to_type, #to_type

Constructor Details

#initialize(element) ⇒ SingleElementCollection

Returns a new instance of SingleElementCollection.



242
243
244
# File 'lib/parlour/types.rb', line 242

def initialize(element)
  @element = to_type(element)
end

Instance Attribute Details

#elementObject (readonly)

Returns the value of attribute element.



247
248
249
# File 'lib/parlour/types.rb', line 247

def element
  @element
end

Instance Method Details

#collection_nameObject



250
# File 'lib/parlour/types.rb', line 250

def collection_name; end

#describeObject



263
264
265
# File 'lib/parlour/types.rb', line 263

def describe
  "#{collection_name}<#{element.describe}>"
end

#generate_rbiObject



253
254
255
# File 'lib/parlour/types.rb', line 253

def generate_rbi
  "T::#{collection_name}[#{element.generate_rbi}]"
end

#generate_rbsObject



258
259
260
# File 'lib/parlour/types.rb', line 258

def generate_rbs
  "::#{collection_name}[#{element.generate_rbs}]"
end