Sha256: eb691afcb7dc29d3c05a3fa5b47815008536e8282fd0542319eb8c1cc965c96a
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
module Dry::Initializer # Class-level DSL for the initializer module Mixin # Declares a plain argument # # @param [#to_sym] name # # @option options [Object] :default The default value # @option options [#call] :type The type constraings via `dry-types` # @option options [Boolean] :reader (true) Whether to define attr_reader # # @return [self] itself # def param(name, **options) @initializer_builder = initializer_builder .reload(self, name, option: false, **options) self end # Declares a named argument # # @param (see #param) # @option (see #param) # @return (see #param) # def option(name, **options) @initializer_builder = initializer_builder .reload(self, name, option: true, **options) self end # @private def initializer_builder @initializer_builder ||= Builder.new end # @private def inherited(klass) klass.instance_variable_set :@initializer_builder, initializer_builder.dup end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dry-initializer-0.2.1 | lib/dry/initializer/mixin.rb |