Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 00:14
    thekuwayama starred dry-rb/dry-monads
  • Dec 11 09:29
    blasterun starred dry-rb/dry-monads
  • Dec 11 08:34
    flash-gordon closed #115
  • Dec 11 08:34
    flash-gordon commented #115
  • Dec 11 08:31

    flash-gordon on v1.3.3

    (compare)

  • Dec 11 08:30

    flash-gordon on master

    Bump version to 1.3.3 (compare)

  • Dec 11 08:30

    flash-gordon on master

    Update CHANGELOG (compare)

  • Dec 10 23:46
    johnmaxwell commented #116
  • Dec 10 21:54

    flash-gordon on master

    Halt with mutable backtrace Ex… Merge pull request #116 from jo… (compare)

  • Dec 10 21:54
    flash-gordon closed #116
  • Dec 10 21:54
    flash-gordon commented #116
  • Dec 10 21:49
    johnmaxwell commented #116
  • Dec 10 21:47
    johnmaxwell commented #116
  • Dec 10 21:43
    johnmaxwell commented #116
  • Dec 10 21:39
    johnmaxwell commented #116
  • Dec 10 21:31
    johnmaxwell commented #116
  • Dec 10 21:22
    flash-gordon commented #116
  • Dec 10 19:41
    johnmaxwell opened #116
  • Dec 10 19:36
  • Dec 10 10:24
    krautcat starred dry-rb/dry-view
Tim Riley
@timriley
It’s not an online thing, unfortunately. @alexandru-calinoiu as solnic mentioned in the forum, detailed guides/workshops etc. will probably wait until we’re 1.0 on the gems
Spencer Goh
@dymaxionuk

How are we supposed to mock operations?

class MyOp
  def call(inputs)
    // lightweight do something
    my_wrapped_op.call(stuff) do |m|
      m.success do |v|
         // do something
      end
    end
    // clean up and return stuff
  end
end

This however doesn't work because my_wrapped_op should call the block with a Dry::Matcher::Evaluator - my test however shouldn't get into the internals of dry operations.

expect MyOp.to_receive(:call) {|&block| block.call( Success('something') }

Am I approaching this wrong?

Gustavo Caso
@GustavoCaso
Are we talking about dry-transaction? @dymaxionuk
Gustavo Caso
@GustavoCaso
?
Nico Ritschel
@nicosuave
Has anyone nested transactions with dry-transaction? I'm thinking this might provide a sane way to organize a moderately complex flow with lots of branching & provide more encapsulation/reusability. I.e. a single step in a parent transaction calls a child transaction
Nico Ritschel
@nicosuave
I am not using operations containers, but rather local operations and anything common I have just been extracting into behvaior-centric modules, so perhaps I'm missing critical info here.
Tim Riley
@timriley
@nicosuave I don’t see why you couldn’t use a transaction object as a step for another transaction
Nico Ritschel
@nicosuave
Thanks @timriley, I was hoping to avoid anti-patterns and was curious if anyone had composed transactions similarly. Will proceed forward :metal:
Tim Riley
@timriley
Trasactions are just operations themselves, at the end of the day
Nico Ritschel
@nicosuave
:)
Spencer Goh
@dymaxionuk
@GustavoCaso sorry that class MyOp was supposed to be a dry-transaction/operation
Guilherme Moreira
@gmmoreira
@nicosuave I have been using and they work pretty well. The interface of a transaction is the same of the operations, respond to call and return success or failure.
Alexander
@cutalion
hey! Are there somebody who can show test setup with dry-system and stubs?
My problem is that I have a boot.rb file, which I load in tests, but it finalizes and freezes the app container, so enable_stubs! does not work after that.
Alexander
@cutalion
for now I ended with this in my boot.rb file (which loads everything and is a entry point for the app)
if ENV['RACK_ENV'] == 'test'
  require 'dry/system/stubs'
  App.enable_stubs!
end
btw, I wrote this a long time ago:
require_relative 'app/container'
require_relative 'app/transaction'
require_relative 'app/operation'
require_relative 'app/import'

if ENV['RACK_ENV'] == 'test'
  require 'dry/system/stubs'
  App.enable_stubs!
end

App.finalize! do |container|
  # Boot the app config before everything else
  container.start :app_config
  container.start :i18n
end

require_relative 'app/api'
Alexander
@cutalion
I remember I looked at berg app and was trying to build my own app. So, I do not remember why I require api after finalize! :smile:
app/api here defines grape application.
Can somebody else share config for dry-system/dry-web application too? Would be interesting to compare
Tim Riley
@timriley
@cutalion don’t load the boot file in tests
@cutalion just require the container directly: require “my_app/container”, this will leave it un-finalized and allow you to add the stubs support
Steve Clarke
@srcnix
Is there anyway in Dry System Container to load all files in a specific directory as bootable? Or is it a simple case of that's how much app works so down to me? Just wondering what conventions are already built in.
Piotr Solnica
@solnic
@srcnix bootable components are registered via Container.boot method
by convention, we store them under {system_dir}/boot/*.rb
Steve Clarke
@srcnix
Thanks @solnic
Mateusz Kluge
@inclooder
Hello, Is it possible to set default value for key in dry-validation ? For example optional(:enabled).maybe(:bool?) to be false by default?
Lairan
@alex-lairan

You can use http://dry-rb.org/gems/dry-validation/input-preprocessing/

optional(:enabled, FalseBoolean).maybe(:bool?)

Mateusz Kluge
@inclooder
How would you define FalseBolean ? Dry::Types.module::Bool.default(false) or Dry::Types.module::Strict::Bool.default(false) ?
Does it matter ?
Lairan
@alex-lairan

I don't know, sorry :s

An example of what i've done:

module Types
  include Dry::Types.module

  Checkbox = Types::Bool.constructor do |str|
    str == '1' || str == true || str == 'true'
  end
end
I think you can do something like
FalseBolean = Types::Bool.constructor do |value|
  value || false
end
Mateusz Kluge
@inclooder
Thank you @alex-lairan I'll check if that solves my problem. Have a good day :+1:
Lairan
@alex-lairan
:+1:
Ivan Shamatov
@IvanShamatov
Hello there
I’m looking at dry-view for quite a while now and it sounds rediculus to have templateless-view, right?
though i found it really useful to operate like serializer
maybe I’m missing something again, are there any consideration on that question?
Tim Riley
@timriley
@IvanShamatov dry-view still uses templates
Spencer Goh
@dymaxionuk
Anyone here use dry-web-roda / dry-rb + IntelliJ. I find the IDE gets really confused (syntax/error highlighting), because of the dynamic lookups the framework gives (ioc, module factories etc). Have you found anyway of making IntelliJ less confused?
Erik Jenks
@erikjenks
Question for those of you who use Dry::Validation. I am currently attempting to generate some API documentation and I am using Dry::Validation for input. Is there a way to parse a Schema to view acceptable parameters and values?
Oskar Szrajer
@gotar
Hi, any easy way to extend Dry-system based app (dry-web) with own acronym (dry-inflector). I know Dry-system use dry-loader and it is initialized with Inflector instance - and I can overwrite loader. But maybe there is easier way just to extend those inflector instance somehow?
@flash-gordon ^?
ps thx for extending dry-inflector (acronyms) ;]
Nikita Shilnikov
@flash-gordon
@gotar I would go with a custom loader for now, but I think we could have it as a standalone config option that is passed to the loader
I actually have the same problem but didn't have a chance to set up my app with the new inflector
I'll do it before a new relaese, I hope soon
Oskar Szrajer
@gotar
ok thx for info :) Yes some custom config will be nice, something like custom boot script for inflector, registered inside container, and then passed as a config option for dry-system
sound good
Jonah
@jonahx
best practice question, not specifically related to the dry gems but input from regulars here would be appreciated. say you have a class that raises specific domain errors, related to that class. Do you:
  1. Define the custom error classes inside the domain class and access them like MyClass::MyError?
  2. Define the custome error classes in the same file as the domain class but outside of it, so client code can directly access MyError?
  3. Something else?
Andy Holland
@AMHOL
I'd namespace it, MyClass::MyError
Jonah
@jonahx

I want a type to represent a non empty string, is there a builtin for this or should I just do:

NonEmptyString = Types::Strict::String.constrained(
  format: /\S+/
)

?