summaryrefslogtreecommitdiff
path: root/lib/pry/config/value.rb
blob: 3afec3866d0de9a8878cd43b6ee6da93cfff5e02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class Pry
  class Config
    # Value holds a value for the given attribute and decides how it should
    # be read. Procs get called, other values are returned as is.
    #
    # @since ?.?.?
    # @api private
    class Value
      def initialize(value)
        @value = value
      end

      def call
        unless [Config::MemoizedValue, Config::LazyValue].include?(@value.class)
          return @value
        end

        @value.call
      end
    end
  end
end