Class: Dry::Monads::List::ListBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/dry/monads/list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ ListBuilder

Returns a new instance of ListBuilder.



357
# File 'lib/dry/monads/list.rb', line 357

def initialize(type) = @type = type

Instance Attribute Details

#typeObject (readonly)



355
356
357
# File 'lib/dry/monads/list.rb', line 355

def type
  @type
end

Instance Method Details

#[](*args) ⇒ Object



359
# File 'lib/dry/monads/list.rb', line 359

def [](*args) = List.new(args, type)

#coerce(value) ⇒ Object



361
# File 'lib/dry/monads/list.rb', line 361

def coerce(value) = List.coerce(value, type)

#pure(val = Undefined, &block) ⇒ Object



363
364
365
366
# File 'lib/dry/monads/list.rb', line 363

def pure(val = Undefined, &block)
  value = Undefined.default(val, block)
  List.pure(value, type)
end