These are chat archives for dry-rb/chat

18th
Aug 2017
siassaj
@siassaj
Aug 18 2017 02:59
anyone?
Danny
@dikond
Aug 18 2017 09:02
Do you want to check that it is a exactly lambda? Becaus in case of proc it is pretty easy. You have to define a Type and use it.
module Types
  include Dry::Types.module

  Proc = Dry::Types::Definition.new(Proc).constrained(type: Proc)
end

class MyStruct < Dry::Struct
  attribute :test
end

MyStruct.new(test: -> { puts 'yay' })
Danny
@dikond
Aug 18 2017 09:23
Sorry, mised a type above, should be attribute :test, Types::Proc