Sha256: ad8695d815ffbce61c15b79bfbe7a7b36f38976312ebaa1e808eba274815f4f3
Contents?: true
Size: 1 KB
Versions: 1
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true module Qonfig module Commands # @api private # @since 0.1.0 class AddNestedOption < Base # @return [String,Symbol] # # @api private # @since 0.1.0 attr_reader :key # @return [Proc] # # @api private # @since 0.1.0 attr_reader :nested_definitions # @param key [String,Symbol] # @param nested_definitions [Proc] # # @api private # @since 0.1.0 def initialize(key, nested_definitions) @key = key @nested_definitions = nested_definitions end # @param settings [Qonfig::Settings] # @return [void] # # @api private # @since 0.1.0 def call(settings) nested_data_set = Class.new(Qonfig::DataSet).tap do |data_set| data_set.instance_eval(&nested_definitions) end nested_settings = nested_data_set.new.settings settings.__define_setting__(key, nested_settings) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
qonfig-0.1.0 | lib/qonfig/commands/add_nested_option.rb |