Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Nikita Shilnikov
@flash-gordon
you don't call super in your constructors
def initialize(name:, **deps)
  super(deps)
  @name = name
  @object = dependency.new
end
Jaroslav
@jarosluv
@flash-gordon Oh, of course, I got it now. Thank you!
And maybe you can give me some examples of use-cases of dry-initializer in compare with dry-struct?
I find out that I need use this gems for objects of different purposes. But what does it mean technically?
Nikita Shilnikov
@flash-gordon
I don't have any examples of using dry-initializer beyond library code. You can find plenty of usages in rom but I don't need it in application code because of DI and dry-auto_inject
and dry-struct is ADT in ruby, basically
that is plain structures or combinations via sums
I don't have custom constructors for structs, it would feel wrong
Jaroslav
@jarosluv
Thank you for explanation!
Felix Wolfsteller
@fwolfst
Hi there
Where is the source to the documentation and how can I contribute to it?
Nikita Shilnikov
@flash-gordon
@fwolfst here you are https://github.com/dry-rb/dry-rb.org
Felix Wolfsteller
@fwolfst
I am quite surprised that I did not find any pointers to that question.
@flash-gordon cool, thanks.
@flash-gordon fwiw, there is an issue with the dry-initializer doc, I believe (last example of the type-constraints section: https://github.com/dry-rb/dry-rb.org/blob/master/source/gems/dry-initializer/type-constraints.html.md
Nikita Shilnikov
@flash-gordon
@fwolfst you can ping @nepalez if something isn't right
Felix Wolfsteller
@fwolfst
@nepalez ^^ I think location shall be an option and not an param in that last example. And also the naming "param" is weird for the first reader. It assumes some knowledge about the second argument. Arguably it could be named "this_param" for clarification (or something like that).
Felix Wolfsteller
@fwolfst
@nepalez feel free to create an issue and assign it or mention me, I'd update the doc
thanks.
Ahmad Musaffa
@musaffa
The example shows deploying a Sinatra app in AWS Lambda. Deploying dry-web-rodaapp should also be trivial.
Grant Shangreaux
@gcentauri
Hoping to get something at my work using dry/rom/lambda . There was
Piotr Solnica
@solnic
this is awesome news indeed :)
Nikita Shilnikov
@flash-gordon
AFAIK cobol is also supported
Jeff Dickey
@jdickey
Coming soon: IBM RPG :older_man:
not to take away from the awesomeness; anything that lets devs use their favourite/existing-products' languages in new ways is almost by definition a Good Thing
Christian Georgii
@cgeorgii

Hi, I've been thinking about opening a pull request for dry-struct to make it quack a bit more like a hash in order to enable validating it with dry-validation. Nowadays an attempt to call a schema with a struct object throws an error. I don't understand if this is a conscious design decision because it seems like a useful use case.

What I want to enable is this:

schema = Dry::Validation.Schema { required(:age).filled(gteq?: 18) }

User.new(age: 17)

schema.(user)
#<Dry::Validation::Result output=#<User age=17> errors={:age=>["must be greater than or equal to 18"]}>
Nikita Shilnikov
@flash-gordon
you're supposed to create structs from valid data hence it doesn't make sense to pass structs to dry-v
Christian Georgii
@cgeorgii
Ok, thanks for the quick answer

Another question, then

BMI = Dry::Types['strict.int'].constrained(gteq: 18, lteq: 42).constructor { |x| x.round }

BMI[17.5]
#=> 18

BMI.valid?(17.5)
#=> false

Does this behavior make sense or is it a bug?

Nikita Shilnikov
@flash-gordon
not something I would expect tbh
mb there are reasons for that, requires checking out the code
Christian Georgii
@cgeorgii
Ok, I will take a look
Nikita Shilnikov
@flash-gordon
@solnic https://github.com/dry-rb/dry-types/blob/287e732d12a96ab9f54955754f10d4afa5e5abf8/lib/dry/types/constructor.rb#L82 here the constructor types doesn't apply fn to value. Doesn't it seem wrong?
@cgeorgii ^
Piotr Solnica
@solnic
@flash-gordon it does
Nikita Shilnikov
@flash-gordon
@cgeorgii pls file an issue, I'll take care of it tomorrow
Christian Georgii
@cgeorgii
Alright, but let me know if you want me to take a stab at it ;)
Nikita Shilnikov
@flash-gordon
permission granted ;)
Christian Georgii
@cgeorgii
Cool, I will let you know
Christian Georgii
@cgeorgii
@flash-gordon Just opened a PR for this here: dry-rb/dry-types#277 :fireworks:
Let me know if you have any thoughts or questions.
Nikita Shilnikov
@flash-gordon
:+1: will check it out
Jules Ivanic
@guizmaii

Hi everyone,

First, I want to thanks all of the people working on this project ! It’s an awesome project ! :clap:

Second, is there any .sequence method proposed in dry-rb ?

sequence signature is: F[G[A]] -> G[F[A]]
Nikita Shilnikov
@flash-gordon
@guizmaii called w/o a block traverse acts as sequence https://github.com/dry-rb/dry-monads/blob/master/lib/dry/monads/list.rb#L263-L286
Jules Ivanic
@guizmaii
ok thanks :)
Jules Ivanic
@guizmaii
does it work on Ruby Array ?
Nikita Shilnikov
@flash-gordon
nope, we don't monkey patch core classes, it's against our philosophy :)