Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Piotr Solnica
@solnic
it’s just an idea that a system is composed of multiple components, a component is an isolated part of a system that exposes some API that other components rely on
ie persistence component provides repositories that other components use to get application data
Krzysztof Wawer
@wafcio
I am wondering why it is named components instead of containers inside lib directory
Piotr Solnica
@solnic
components are stored in containers
actually system == container
but the fact it’s a container is an implementation detail, it just happens to use dry-container under the hood, hence the System::Container class name
Krzysztof Wawer
@wafcio
ok thanks
Rafael George
@cored
@solnic I was checking dry-validation specs
what do you think in turning some of those integration test into feature test. In terms of presenting some use cases like
'when you do this you will have that' because even following the integration specs is hard to know how everything works together from a client point of view
Piotr Solnica
@solnic
@cored the intentation of these specs wasn’t really to document usage :)
Rafael George
@cored
do you think will be valuable to have somthing like that ?
Piotr Solnica
@solnic
not sure tbh, the amount of use cases that we have is enormous, pretty much unlimited, there are already thousands of integration specs, not sure what kind of value feature specs would give us
esp that at the end of the day we need to write user documentation anyway
no specs will replace that
so I’m not very fond of the idea of having even more specs, unless they really provide additional value from test cov pov
Rafael George
@cored
gotcha
I was trying to understand what will be an entry point for the library
Jānis Miezītis
@janjiss
This message was deleted
Jānis Miezītis
@janjiss

Hey folks, wanted to discuss following idea. In application there are cases
where I want to have inheritance on Dry::Struct, but the child struct has
few less attributes. For example user has name, but manager does not require it:

class User < Dry::Types::Struct
  attribute :name, Dry::Types::String
end
class Manager < User
  ignore_attributes :name
end

What about having ignore_attributes option that just removes a specified attribute? Thoughts?

Piotr Solnica
@solnic
@janjiss just restructure your inheritance hierarchy so it’s not needed
@cored an entry point?
Rafael George
@cored
like I think in terms of what operations can I do with this system
Piotr Solnica
@solnic
Schema#call
Rafael George
@cored
taking an example from your own talk
you had something like CreateUser def call() method in that case createUser is my entry point
maybe a vague word to describe that situation
John Backus
@backus
@backus do you think we could wrap up dry-struct?
I have a growing need for it in my current project at work…I start having usecases similar to yours, so I’m motivated to help with that
@solnic I'm glad our use cases are beginning to overlap :) :)
I can try to find some time for it soon
To manage expectations though you should know that I have some big deadlines for work over the next 7 days so I might not get to it until then worst case
Piotr Solnica
@solnic
@backus cool man, it’d be awesome if we could wrap this up before Sept 12
John Backus
@backus
Okie doke that works with my timeline I think
Piotr Solnica
@solnic
@backus I fixed a bunch of things today so it’s pretty much ready for development
John Backus
@backus
Nice yeah I saw
I assume the constrained? thing is API on dry-types that needs to be consistent
Piotr Solnica
@solnic
@backus that and also fixed gemspec to use VERSION and fixed one failing spec due to a reference to a constant that was no longer there :)
small stuff
John Backus
@backus
Great
@solnic do you think dry-struct needs to implement these new interfaces before it can be released?
in other words, are the different constructor behaviors release blockers?
Piotr Solnica
@solnic
no, but I wouldn’t want to release it w/o them, as it’s gonna introduce a new lib, so people may start picking it up, and a couple of weeks later we may change things, so better to change it already :)
John Backus
@backus
ah kk
Jānis Miezītis
@janjiss
Is there a way to map Sequel result set to Dry::Structs apart from doing result.map {|attrs| MyStruct.call(attrs) } ?
Don Morrison
@elskwid
Hey @blelump, did you ever get your reloading thing working? The message I saw you post seemed familiar to me - something we saw when using Wisper in Rails.
The fix was to wrap up the container clearing in the Rails.application.config.to_prepare block. Not sure if that will help you but it may.
Krzysztof Wawer
@wafcio
@solnic What is the difference between load_path and auto_register ? In example code (dry-system) you use these two methods with the same arguments. I read dry/system/container.rb but unfortunatelly I still don’t know the difference
Tim Riley
@timriley
Load path just adds the directories to Ruby's $LOAD_PATH
Krzysztof Wawer
@wafcio
I have just found small bug in dry-system, comment say that system_dir by default is component but in code I see system value. I can send PR with fix it but I don’t know which part should be changed
Michał Pietrus
@blelump
Hi @elskwid ! Nah, not yet... From what I remember, the Rails.application.config.to_prepare performs after reloading so I've started with ActionDispatch::Reloader.to_prepare. However, even though I explicitly override the container instance (AppContainer.instance_variable_set('@_container', ::Concurrent::Hash.new)), the underlying problem still persists. I've seen how dry-t rails solves this problem, but I'm not sure it would help. I'll start with it again in September