Sha256: e43255234bd474f33c2f6c76f4325296980ab8db56152643e176f514b9faea45
Contents?: true
Size: 703 Bytes
Versions: 6
Compression:
Stored size: 703 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) 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.(key)) end end end end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems