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

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

Overview

Checks the reader privacy

Instance Method Summary collapse

Instance Method Details

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



7
8
9
10
11
12
13
14
15
16
# File 'lib/dry/initializer/dispatchers/prepare_reader.rb', line 7

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