These are chat archives for dry-rb/chat

23rd
Jul 2016
Odin Dutton
@twe4ked
Jul 23 2016 02:19
“Initial commit” is dry-web-roda new foo
any ideas?
Odin Dutton
@twe4ked
Jul 23 2016 02:26
I'll be back on later.
Tim Riley
@timriley
Jul 23 2016 05:13
@twe4ked I'll have a chance to take a look tonight!
Odin Dutton
@twe4ked
Jul 23 2016 05:38
Thanks @timriley
Fran Worley
@fran-worley
Jul 23 2016 07:30
@flash-gordon unfortunately you don't seem to be able to edit messages in the iOS app, one of many irritations...
Piotr Solnica
@solnic
Jul 23 2016 08:16
It is buggy on ios
Tim Riley
@timriley
Jul 23 2016 11:02
@twe4ked so, to clarify, the issue you’re seeing is that there’s too much warning output in that RSpec run?
It looks like the command itself actually succeeds.
Tim Riley
@timriley
Jul 23 2016 11:08
@twe4ked Strange. I just made a new dry-web-roda app, added a single foo spec, ran it, and got no such warning output. Gist upcoming...
Tim Riley
@timriley
Jul 23 2016 11:34
Ah, hang on...
@twe4ked ah yes, if I require “app_helper” in the spec file I get a similar kind of warning output
Only one warning seems to be related to a dry- gem (dry-transaction). I’ll file a bug for that.
I think it might make sense to change the default rspec config so that warnings are off.
It’s too confronting to see all those issues, especially when many of them are far upstream from your app.
Tim Riley
@timriley
Jul 23 2016 11:44
Andrew Kozin
@nepalez
Jul 23 2016 14:23

@solnic & Co:

What do you think about polluting Dry::Types.module with a method like this

def self.register(type, as: type)
  key = Dry::Types.identifier(as)

  unless Dry::Types.type_keys.include? key
    type = Dry::Types::Definition[type].new(type) if Class === type
    Dry::Types.register key, definition
    Dry::Types.define_constants self, [key]
  end

  Dry::Types[key]
end

IMO this could provide a bit prettier DSL for including types:

module MyTypes
  include Dry::Types.module

  register ::Regexp # registers new primitive from the class
  register Regexp.constrained(type: ::Regexp), as: 'strict.regexp'
  # etc
end

or maybe I just missing some options to do this in a simpler way?

Piotr Solnica
@solnic
Jul 23 2016 15:49
@nepalez this api is not final so would be nice to come up with sth more convenient. Super low on my todo list though so I didn't do it yet. Pls report an issue with your ideas and we can discuss there