Module: Dry::Initializer::Dispatchers::PrepareReader

Extended by:
PrepareReader
Included in:
PrepareReader
Defined in:
lib/dry/initializer/dispatchers/prepare_reader.rb

Instance Method Summary collapse

Instance Method Details

#call(target: nil, reader: :public, **options) ⇒ Object


11
12
13
14
15
16
17
18
19
20
# File 'lib/dry/initializer/dispatchers/prepare_reader.rb', line 11

def call(target: nil, reader: :public, **options)
  reader = case reader.to_s
           when "false", ""                      then nil
           when "true"                           then :public
           when "public", "private", "protected" then reader.to_sym
           else invalid_reader!(target, reader)
           end

  {target: target, reader: reader, **options}
end