Sha256: cd698211ed5b1a0f60601f726c4b8557de50c3e6cb4f1e6d764ce2784c59b6a3

Contents?: true

Size: 585 Bytes

Versions: 1

Compression:

Stored size: 585 Bytes

Contents

require 'mustermann/pattern'
require 'mustermann/simple_match'

module Mustermann
  # Matches strings that are identical to the pattern.
  #
  # @example
  #   Mustermann.new('/*.*', type: :shell) === '/bar' # => false
  #
  # @see Pattern
  # @see file:README.md#shell Syntax description in the README
  class Shell < Pattern
    FLAGS ||= File::FNM_PATHNAME | File::FNM_DOTMATCH | File::FNM_EXTGLOB

    # @param (see Pattern#===)
    # @return (see Pattern#===)
    # @see (see Pattern#===)
    def ===(string)
      File.fnmatch? @string, unescape(string), FLAGS
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mustermann-0.0.1 lib/mustermann/shell.rb