Sha256: 399121b5b42584b085e2d2d4187f020772e1f840e47dada739bb16a1079c5057

Contents?: true

Size: 569 Bytes

Versions: 34

Compression:

Stored size: 569 Bytes

Contents

# frozen_string_literal: true

require 'active_support/core_ext/object/blank'

module Avm
  # String with paths like PATH variable.
  # Note: the separator is not system dependent.
  class PathString < String
    SEPARATOR = ':'

    class << self
      # Shortcut for [Avm::Paths.new(string).paths].
      def paths(string)
        new(string).paths
      end
    end

    def initialize(string = nil)
      super(string.to_s)
    end

    # @return [Array] List of paths. Blank paths are rejected.
    def paths
      split(SEPARATOR).compact_blank
    end
  end
end

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
avm-0.94.1 lib/avm/path_string.rb
eac_tools-0.98.0 sub/avm/lib/avm/path_string.rb
avm-0.94.0 lib/avm/path_string.rb
eac_tools-0.94.0 sub/avm/lib/avm/path_string.rb
avm-0.93.0 lib/avm/path_string.rb
eac_tools-0.92.0 sub/avm/lib/avm/path_string.rb
avm-0.92.0 lib/avm/path_string.rb
eac_tools-0.91.0 sub/avm/lib/avm/path_string.rb
avm-0.90.1 lib/avm/path_string.rb
eac_tools-0.87.1 sub/avm/lib/avm/path_string.rb
avm-0.90.0 lib/avm/path_string.rb
eac_tools-0.87.0 sub/avm/lib/avm/path_string.rb
avm-0.89.0 lib/avm/path_string.rb
eac_tools-0.86.12 sub/avm/lib/avm/path_string.rb
avm-0.88.0 lib/avm/path_string.rb
eac_tools-0.86.11 sub/avm/lib/avm/path_string.rb
avm-0.87.0 lib/avm/path_string.rb
eac_tools-0.86.8 sub/avm/lib/avm/path_string.rb
avm-0.86.2 lib/avm/path_string.rb
eac_tools-0.86.7 sub/avm/lib/avm/path_string.rb