Sha256: a51c66eba037301d68bd9e75ed5403f57a7271bf30bdb28c2bc687cda361bb89

Contents?: true

Size: 847 Bytes

Versions: 44

Compression:

Stored size: 847 Bytes

Contents

# frozen_string_literal: true

require 'ehbrs/observers/with_persistence'
require 'ehbrs/user_dirs'

module Ehbrs
  module Self
    module Observers
      class WithPersistence
        enable_simple_cache
        common_constructor :label

        def check_current_value
          observer.check(current_value)
        end

        def changing_value?
          observer.changing_value?(current_value)
        end

        private

        def current_value_uncached
          calculate_value
        end

        def observer_uncached
          ::Ehbrs::Observers::WithPersistence.new(persistence_path, blank_value: :raise)
        end

        def persistence_path_uncached
          ::Ehbrs::UserDirs.data.child('observers', label.to_s.parameterize)
                           .content_path.to_pathname
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
ehbrs-tools-0.37.0 lib/ehbrs/self/observers/with_persistence.rb
ehbrs-tools-0.36.0 lib/ehbrs/self/observers/with_persistence.rb
ehbrs-tools-0.35.1 lib/ehbrs/self/observers/with_persistence.rb
ehbrs-tools-0.35.0 lib/ehbrs/self/observers/with_persistence.rb
ehbrs-tools-0.34.0 lib/ehbrs/self/observers/with_persistence.rb
ehbrs-tools-0.33.0 lib/ehbrs/self/observers/with_persistence.rb
ehbrs-tools-0.32.0 lib/ehbrs/self/observers/with_persistence.rb
ehbrs-tools-0.31.1 lib/ehbrs/self/observers/with_persistence.rb
ehbrs-tools-0.31.0 lib/ehbrs/self/observers/with_persistence.rb
ehbrs-tools-0.30.0 lib/ehbrs/self/observers/with_persistence.rb
ehbrs-tools-0.29.0 lib/ehbrs/self/observers/with_persistence.rb
ehbrs-tools-0.28.3 lib/ehbrs/self/observers/with_persistence.rb
ehbrs-tools-0.28.2 lib/ehbrs/self/observers/with_persistence.rb
ehbrs-tools-0.28.1 lib/ehbrs/self/observers/with_persistence.rb
ehbrs-tools-0.28.0 lib/ehbrs/self/observers/with_persistence.rb
ehbrs-tools-0.27.0 lib/ehbrs/self/observers/with_persistence.rb
ehbrs-tools-0.26.0 lib/ehbrs/self/observers/with_persistence.rb
ehbrs-tools-0.25.1 lib/ehbrs/self/observers/with_persistence.rb
ehbrs-tools-0.25.0 lib/ehbrs/self/observers/with_persistence.rb
ehbrs-tools-0.24.0 lib/ehbrs/self/observers/with_persistence.rb