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.



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

def initialize(type) = @type = type

Instance Attribute Details

#typeObject (readonly)



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

def type
  @type
end

Instance Method Details

#[](*args) ⇒ Object



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

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

#coerce(value) ⇒ Object



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

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

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



366
367
368
369
# File 'lib/dry/monads/list.rb', line 366

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