Skip to content

Instantly share code, notes, and snippets.

@kspurgin
Last active October 12, 2022 01:04
Show Gist options
  • Save kspurgin/6da4ccdf9f71c178f9416a104e169f0f to your computer and use it in GitHub Desktop.
Save kspurgin/6da4ccdf9f71c178f9416a104e169f0f to your computer and use it in GitHub Desktop.
dry-configuration 0.16.0 bug scripts
# frozen_string_literal: true
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'dry-configurable', '= 0.15.0'
end
class Something
def initialize(msg)
@msg = msg
end
end
module App
module_function
extend Dry::Configurable
setting :thing,
constructor: proc{ Something.new('blah') },
reader: true
end
thing1 = App.thing
thing2 = App.thing
[thing1, thing2].each do |thing|
puts thing.object_id
end
# frozen_string_literal: true
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'dry-configurable', '= 0.16.0'
end
class Something
def initialize(msg)
@msg = msg
end
end
module App
module_function
extend Dry::Configurable
setting :thing,
constructor: proc{ Something.new('blah') },
reader: true
end
thing1 = App.thing
thing2 = App.thing
[thing1, thing2].each do |thing|
puts thing.object_id
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment