lib/config_default/struct.rb in config_default-0.2.4 vs lib/config_default/struct.rb in config_default-0.2.5
- old
+ new
@@ -1,11 +1,11 @@
# frozen_string_literal: true
class ConfigDefault::Struct
RESERVED_METHODS = %i[method_missing respond_to_missing? to_hash].freeze
- def initialize(attributes:, recursive: false, allow_nil: false)
+ def initialize(attributes, recursive: false, allow_nil: false)
@attributes = ActiveSupport::HashWithIndifferentAccess.new(attributes)
@allow_nil = allow_nil
@recursive = recursive
make_recursive!
@@ -45,14 +45,10 @@
def make_recursive!
return unless @recursive
@attributes.each do |key, value|
next unless value.is_a?(Hash)
- @attributes[key] = self.class.new(
- attributes: value,
- recursive: @recursive,
- allow_nil: @allow_nil,
- )
+ @attributes[key] = self.class.new(value, recursive: @recursive, allow_nil: @allow_nil)
end
end
def define_methods!
@attributes.each do |key, value|