summaryrefslogtreecommitdiff
path: root/lib/pry/config/value.rb
blob: b646d97a3df540afa57859d171d0eef4245aefb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

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