Sha256: dc97f1f5e0efb3e62c307f3a460ed7876718e8e29ed42b559300e43bbd64cb0c
Contents?: true
Size: 729 Bytes
Versions: 2
Compression:
Stored size: 729 Bytes
Contents
# frozen_string_literal: true require "dry/effects/effect" module Dry module Effects module Effects class Env < ::Module Read = Effect.new(type: :env, name: :read) def initialize(*args, **kwargs) super() readers = args.zip(args) + kwargs.to_a module_eval do if readers.empty? define_method(:env) do |key| ::Dry::Effects.yield(Read.(key)) end else readers.each do |reader, key| define_method(reader) do ::Dry::Effects.yield(Read.payload(key)) end end end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dry-effects-0.3.0 | lib/dry/effects/effects/env.rb |
dry-effects-0.2.0 | lib/dry/effects/effects/env.rb |