Sha256: 8ebb474365f3ca4db88d887ac22d97b7d0fda23be8044acd9bc6b05c092711cf
Contents?: true
Size: 694 Bytes
Versions: 6
Compression:
Stored size: 694 Bytes
Contents
# frozen_string_literal: true require 'ostruct' module BusinessPipeline class Config < OpenStruct def initialize(hash = nil, &block) super(hash) instance_eval(&block) if block end def fetch(key) value = self[key.to_sym] return value unless value.nil? return yield(key) if block_given? fail KeyError, key end # rubocop:disable Style/MissingRespondToMissing def method_missing(meth, *args, &block) if args.size.zero? || meth.to_s.end_with?('=') super else self[meth] = args.first end end # rubocop:enable Style/MissingRespondToMissing attr_reader :data private :data end end
Version data entries
6 entries across 6 versions & 1 rubygems