Sha256: 14692381b334f4cf35bcc6b91bfe0193e7e9a93cae2ec58ae5ccdae73158566f

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

require 'avm/instances/entry_keys'

module Avm
  module Instances
    class Base
      module AutoValues
        module Filesystem
          def auto_fs_path
            inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
                                  ::Avm::Instances::EntryKeys::FS_PATH) { |v| v + '/' + id }
          end

          def auto_fs_url
            auto_fs_url_with_install || auto_fs_url_without_install
          end

          def auto_fs_url_with_install
            read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_URL)
              .if_present do |install_url|
              read_entry_optional('fs_path').if_present do |fs_path|
                "#{install_url}#{fs_path}"
              end
            end
          end

          def auto_fs_url_without_install
            return nil if read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_URL).present?

            read_entry_optional('fs_path').if_present do |fs_path|
              "file://#{fs_path}"
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
avm-0.39.1 lib/avm/instances/base/auto_values/filesystem.rb
eac_tools-0.25.1 sub/avm/lib/avm/instances/base/auto_values/filesystem.rb
avm-0.39.0 lib/avm/instances/base/auto_values/filesystem.rb
eac_tools-0.25.0 sub/avm/lib/avm/instances/base/auto_values/filesystem.rb