code
stringlengths
26
124k
docstring
stringlengths
23
125k
func_name
stringlengths
1
98
language
stringclasses
1 value
repo
stringlengths
5
53
path
stringlengths
7
151
url
stringlengths
50
211
license
stringclasses
7 values
def read_yaml(throw_missing: false, **kwd) self.class.load_yaml( read, **kwd ) rescue Errno::ENOENT throw_missing ? raise : ( return {} ) end
-- Read the file as a YAML file turning it into an object. @see self.class.load_yaml as this a direct alias of that method. @return Hash --
read_yaml
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def read_json(throw_missing: false) JSON.parse( read ) rescue Errno::ENOENT throw_missing ? raise : ( return {} ) end
-- Read the file as a JSON file turning it into an object. @see self.class.read_json as this is a direct alias of that method. @return Hash --
read_json
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def split_path @path.split( %r!\\+|/+! ) end
-- @note The blank part is intentionally left there so that you can rejoin. Splits the path into all parts so that you can do step by step comparisons @example Pathutil.new("/my/path").split_path # => ["", "my", "path"] @return Array<String> --
split_path
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def absolute? return !!( @path =~ %r!\A(?:[A-Za-z]:)?(?:\\+|/+)! ) end
-- @note "./" is considered relative. Check to see if the path is absolute, as in: starts with "/" @return true|false --
absolute?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def ascend unless block_given? return to_enum( __method__ ) end yield( path = self ) while (new_path = path.dirname) if path == new_path || new_path == "." break else path = new_path yield new_path end end nil end
-- @yield Pathutil Break apart the path and yield each with the previous parts. @example Pathutil.new("/hello/world").ascend.to_a # => ["/", "/hello", "/hello/world"] @example Pathutil.new("/hello/world").ascend { |path| $stdout.puts path } @return Enum --
ascend
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def descend unless block_given? return to_enum( __method__ ) end ascend.to_a.reverse_each do |val| yield val end nil end
-- @yield Pathutil Break apart the path in reverse order and descend into the path. @example Pathutil.new("/hello/world").descend.to_a # => ["/hello/world", "/hello", "/"] @example Pathutil.new("/hello/world").descend { |path| $stdout.puts path } @return Enum --
descend
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def each_line return to_enum(__method__) unless block_given? readlines.each do |line| yield line end nil end
-- @yield Pathutil @example Pathutil.new("/hello/world").each_line { |line| $stdout.puts line } Wraps `readlines` and allows you to yield on the result. @return Enum --
each_line
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def fnmatch?(matcher) matcher.is_a?(Regexp) ? !!(self =~ matcher) : \ File.fnmatch(matcher, self) end
-- @example Pathutil.new("/hello").fnmatch?("/hello") # => true Unlike traditional `fnmatch`, with this one `Regexp` is allowed. @example Pathutil.new("/hello").fnmatch?(/h/) # => true @see `File#fnmatch` for more information. @return true|false --
fnmatch?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def root? !!(self =~ %r!\A(?:[A-Za-z]:)?(?:\\+|/+)\z!) end
-- Allows you to quickly determine if the file is the root folder. @return true|false --
root?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def in_path?(path) path = self.class.new(path).expand_path.split_path mine = (symlink?? expand_path.realpath : expand_path).split_path path.each_with_index { |part, index| return false if mine[index] != part } true end
-- Allows you to check if the current path is in the path you want. @return true|false --
in_path?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def children ary = [] Dir.foreach(@path) do |path| if path == "." || path == ".." next else path = self.class.new(File.join(@path, path)) yield path if block_given? ary.push( path ) end end ary end
-- @return Array<Pathutil> Grab all of the children from the current directory, including hidden. @yield Pathutil --
children
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def glob(pattern, flags = 0) unless block_given? return to_enum( __method__, pattern, flags ) end chdir do Dir.glob(pattern, flags).each do |file| yield self.class.new( File.join(@path, file) ) end end nil end
-- @yield Pathutil Allows you to glob however you wish to glob in the current `Pathutil` @see `File::Constants` for a list of flags. @return Enum --
glob
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def chdir if !block_given? Dir.chdir( @path ) else Dir.chdir @path do yield end end end
-- @yield &block Move to the current directory temporarily (or for good) and do work son. @note you do not need to ship a block at all. @return nil --
chdir
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def find return to_enum(__method__) unless block_given? Find.find @path do |val| yield self.class.new(val) end end
-- @yield Pathutil Find all files without care and yield the given block. @return Enum --
find
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def each_filename return to_enum(__method__) unless block_given? @path.split(File::SEPARATOR).delete_if(&:empty?).each do |file| yield file end end
-- @yield Pathutil Splits the path returning each part (filename) back to you. @return Enum --
each_filename
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def parent return self if @path == "/" self.class.new(absolute?? File.dirname(@path) : File.join( @path, ".." )) end
-- Get the parent of the current path. @note This will simply return self if "/". @return Pathutil --
parent
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def split File.split(@path).collect! do |path| self.class.new(path) end end
-- @yield Pathutil Split the file into its dirname and basename, so you can do stuff. @return nil --
split
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def sub_ext(ext) self.class.new(@path.chomp(File.extname(@path)) + ext) end
-- @note Your extension should start with "." Replace a files extension with your given extension. @return Pathutil --
sub_ext
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def relative_path_from(from) from = self.class.new(from).expand_path.gsub(%r!/$!, "") self.class.new(expand_path.gsub(%r!^#{ from.regexp_escape }/!, "")) end
-- A less complex version of `relative_path_from` that simply uses a `Regexp` and returns the full path if it cannot be determined. @return Pathutil --
relative_path_from
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def enforce_root(root) return self if !relative? && in_path?(root) self.class.new(root).join( self ) end
-- Expands the path and left joins the root to the path. @return Pathutil --
enforce_root
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def safe_copy(to, root: nil, ignore: []) raise ArgumentError, "must give a root" unless root root = self.class.new(root) to = self.class.new(to) if directory? safe_copy_directory(to, { :root => root, :ignore => ignore }) else safe_copy_file(to, { :root => root }) end end
-- Copy a directory, allowing symlinks if the link falls inside of the root. This is indented for people who wish some safety to their copies. @note Ignore is ignored on safe_copy file because it's explicit. @return nil --
safe_copy
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def normalize return @normalize ||= begin self.class.normalize end end
-- @see `self.class.normalize` as this is an alias. --
normalize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def encoding return @encoding ||= begin self.class.encoding end end
-- @see `self.class.encoding` as this is an alias. --
encoding
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def read(*args, **kwd) kwd[:encoding] ||= encoding if normalize[:read] File.read(self, *args, kwd).encode({ :universal_newline => true }) else File.read( self, *args, kwd ) end end
-- @note You can set the default encodings via the class. Read took two steroid shots: it can normalize your string, and encode. @return String --
read
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def binread(*args, **kwd) kwd[:encoding] ||= encoding if normalize[:read] File.binread(self, *args, kwd).encode({ :universal_newline => true }) else File.read( self, *args, kwd ) end end
-- @note You can set the default encodings via the class. Binread took two steroid shots: it can normalize your string, and encode. @return String --
binread
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def readlines(*args, **kwd) kwd[:encoding] ||= encoding if normalize[:read] File.readlines(self, *args, kwd).encode({ :universal_newline => true }) else File.readlines( self, *args, kwd ) end end
-- @note You can set the default encodings via the class. Readlines took two steroid shots: it can normalize your string, and encode. @return Array<String> --
readlines
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def write(data, *args, **kwd) kwd[:encoding] ||= encoding if normalize[:write] File.write(self, data.encode( :crlf_newline => true ), *args, kwd) else File.write( self, data, *args, kwd ) end end
-- @note You can set the default encodings via the class. Write took two steroid shots: it can normalize your string, and encode. @return Fixnum<Bytes> --
write
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def binwrite(data, *args, **kwd) kwd[:encoding] ||= encoding if normalize[:write] File.binwrite(self, data.encode( :crlf_newline => true ), *args, kwd) else File.binwrite( self, data, *args, kwd ) end end
-- @note You can set the default encodings via the class. Binwrite took two steroid shots: it can normalize your string, and encode. @return Fixnum<Bytes> --
binwrite
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def strip_windows_drive(path = @path) self.class.new(path.gsub( %r!\A[A-Za-z]:(?:\\+|/+)!, "" )) end
-- Strips the windows drive from the path. --
strip_windows_drive
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def aggressive_cleanpath return self.class.new("/") if root? _out = split_path.each_with_object([]) do |part, out| next if part == "." || (part == ".." && out.last == "") if part == ".." && out.last && out.last != ".." out.pop else out.push( part ) end end # -- return self.class.new("/") if _out == [""].freeze return self.class.new(".") if _out.empty? && (end_with?(".") || relative?) self.class.new(_out.join("/")) end
-- rubocop:disable Metrics/AbcSize rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/PerceivedComplexity --
aggressive_cleanpath
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def pwd new( Dir.pwd ) end
-- @note We do nothing special here. Get the current directory that Ruby knows about. @return Pathutil --
pwd
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def encoding return @encoding ||= begin Encoding.default_external end end
-- @note you are encouraged to override this if you need to. Aliases the default system encoding to us so that we can do most read and write operations with that encoding, instead of being crazy. --
encoding
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def normalize return @normalize ||= { :read => Gem.win_platform?, :write => Gem.win_platform? } end
-- Normalize CRLF -> LF on Windows reads, to ease your troubles. Normalize LF -> CLRF on Windows write, to ease your troubles. --
normalize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def tmpdir(*args) rtn = new(make_tmpname(*args)).tap(&:mkdir) ObjectSpace.define_finalizer(rtn, proc do rtn.rm_rf end) rtn end
-- Make a temporary directory. @note if you adruptly exit it will not remove the dir. @note this directory is removed on exit. @return Pathutil --
tmpdir
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def tmpfile(*args) rtn = new(make_tmpname(*args)).tap(&:touch) ObjectSpace.define_finalizer(rtn, proc do rtn.rm_rf end) rtn end
-- Make a temporary file. @note if you adruptly exit it will not remove the dir. @note this file is removed on exit. @return Pathutil --
tmpfile
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb
Apache-2.0
def load_yaml(data, safe: true, whitelist_classes: allowed[:yaml][:classes], \ whitelist_symbols: allowed[:yaml][:symbols], aliases: :yes) require "yaml" unless safe return YAML.load( data ) end if !YAML.respond_to?(:safe_load) setup_safe_yaml whitelist_classes, aliases SafeYAML.load( data ) else YAML.safe_load( data, whitelist_classes, whitelist_symbols, aliases ) end end
-- Wraps around YAML and SafeYAML to provide alternatives to Rubies. @note We default aliases to yes so we can detect if you explicit true. @return Hash --
load_yaml
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil/helpers.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil/helpers.rb
Apache-2.0
def make_tmpname(prefix = "", suffix = nil, root = nil) prefix = tmpname_prefix(prefix) suffix = tmpname_suffix(suffix) root ||= Dir::Tmpname.tmpdir File.join(root, __make_tmpname( prefix, suffix )) end
-- Make a temporary name suitable for temporary files and directories. @return String --
make_tmpname
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil/helpers.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil/helpers.rb
Apache-2.0
def initialize(*args) @tld, @sld, @trd = args yield(self) if block_given? end
Creates and returns a new {PublicSuffix::Domain} instance. @overload initialize(tld) Initializes with a +tld+. @param [String] tld The TLD (extension) @overload initialize(tld, sld) Initializes with a +tld+ and +sld+. @param [String] tld The TLD (extension) @param [String] sld The TRD (domain) @overload initialize(tld, sld, trd) Initializes with a +tld+, +sld+ and +trd+. @param [String] tld The TLD (extension) @param [String] sld The SLD (domain) @param [String] trd The TRD (subdomain) @yield [self] Yields on self. @yieldparam [PublicSuffix::Domain] self The newly creates instance @example Initialize with a TLD PublicSuffix::Domain.new("com") # => #<PublicSuffix::Domain @tld="com"> @example Initialize with a TLD and SLD PublicSuffix::Domain.new("com", "example") # => #<PublicSuffix::Domain @tld="com", @trd=nil> @example Initialize with a TLD, SLD and TRD PublicSuffix::Domain.new("com", "example", "wwww") # => #<PublicSuffix::Domain @tld="com", @trd=nil, @sld="example">
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/domain.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/domain.rb
Apache-2.0
def to_a [@trd, @sld, @tld] end
Returns an array containing the domain parts. @return [Array<String, nil>] @example PublicSuffix::Domain.new("google.com").to_a # => [nil, "google", "com"] PublicSuffix::Domain.new("www.google.com").to_a # => [nil, "google", "com"]
to_a
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/domain.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/domain.rb
Apache-2.0
def name [@trd, @sld, @tld].compact.join(DOT) end
Returns the full domain name. @return [String] @example Gets the domain name of a domain PublicSuffix::Domain.new("com", "google").name # => "google.com" @example Gets the domain name of a subdomain PublicSuffix::Domain.new("com", "google", "www").name # => "www.google.com"
name
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/domain.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/domain.rb
Apache-2.0
def domain [@sld, @tld].join(DOT) if domain? end
Returns a domain-like representation of this object if the object is a {#domain?}, <tt>nil</tt> otherwise. PublicSuffix::Domain.new("com").domain # => nil PublicSuffix::Domain.new("com", "google").domain # => "google.com" PublicSuffix::Domain.new("com", "google", "www").domain # => "www.google.com" This method doesn't validate the input. It handles the domain as a valid domain name and simply applies the necessary transformations. This method returns a FQD, not just the domain part. To get the domain part, use <tt>#sld</tt> (aka second level domain). PublicSuffix::Domain.new("com", "google", "www").domain # => "google.com" PublicSuffix::Domain.new("com", "google", "www").sld # => "google" @see #domain? @see #subdomain @return [String]
domain
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/domain.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/domain.rb
Apache-2.0
def subdomain [@trd, @sld, @tld].join(DOT) if subdomain? end
Returns a subdomain-like representation of this object if the object is a {#subdomain?}, <tt>nil</tt> otherwise. PublicSuffix::Domain.new("com").subdomain # => nil PublicSuffix::Domain.new("com", "google").subdomain # => nil PublicSuffix::Domain.new("com", "google", "www").subdomain # => "www.google.com" This method doesn't validate the input. It handles the domain as a valid domain name and simply applies the necessary transformations. This method returns a FQD, not just the subdomain part. To get the subdomain part, use <tt>#trd</tt> (aka third level domain). PublicSuffix::Domain.new("com", "google", "www").subdomain # => "www.google.com" PublicSuffix::Domain.new("com", "google", "www").trd # => "www" @see #subdomain? @see #domain @return [String]
subdomain
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/domain.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/domain.rb
Apache-2.0
def domain? !(@tld.nil? || @sld.nil?) end
Checks whether <tt>self</tt> looks like a domain. This method doesn't actually validate the domain. It only checks whether the instance contains a value for the {#tld} and {#sld} attributes. @example PublicSuffix::Domain.new("com").domain? # => false PublicSuffix::Domain.new("com", "google").domain? # => true PublicSuffix::Domain.new("com", "google", "www").domain? # => true # This is an invalid domain, but returns true # because this method doesn't validate the content. PublicSuffix::Domain.new("com", nil).domain? # => true @see #subdomain? @return [Boolean]
domain?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/domain.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/domain.rb
Apache-2.0
def subdomain? !(@tld.nil? || @sld.nil? || @trd.nil?) end
Checks whether <tt>self</tt> looks like a subdomain. This method doesn't actually validate the subdomain. It only checks whether the instance contains a value for the {#tld}, {#sld} and {#trd} attributes. If you also want to validate the domain, use {#valid_subdomain?} instead. @example PublicSuffix::Domain.new("com").subdomain? # => false PublicSuffix::Domain.new("com", "google").subdomain? # => false PublicSuffix::Domain.new("com", "google", "www").subdomain? # => true # This is an invalid domain, but returns true # because this method doesn't validate the content. PublicSuffix::Domain.new("com", "example", nil).subdomain? # => true @see #domain? @return [Boolean]
subdomain?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/domain.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/domain.rb
Apache-2.0
def initialize @rules = {} yield(self) if block_given? end
Initializes an empty {PublicSuffix::List}. @yield [self] Yields on self. @yieldparam [PublicSuffix::List] self The newly created instance.
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/list.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/list.rb
Apache-2.0
def each(&block) Enumerator.new do |y| @rules.each do |key, node| y << entry_to_rule(node, key) end end.each(&block) end
Iterates each rule in the list.
each
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/list.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/list.rb
Apache-2.0
def add(rule) @rules[rule.value] = rule_to_entry(rule) self end
Adds the given object to the list and optionally refreshes the rule index. @param rule [PublicSuffix::Rule::*] the rule to add to the list @return [self]
add
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/list.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/list.rb
Apache-2.0
def find(name, default: default_rule, **options) rule = select(name, **options).inject do |l, r| return r if r.instance_of?(Rule::Exception) l.length > r.length ? l : r end rule || default end
Finds and returns the rule corresponding to the longest public suffix for the hostname. @param name [#to_s] the hostname @param default [PublicSuffix::Rule::*] the default rule to return in case no rule matches @return [PublicSuffix::Rule::*]
find
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/list.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/list.rb
Apache-2.0
def select(name, ignore_private: false) name = name.to_s parts = name.split(DOT).reverse! index = 0 query = parts[index] rules = [] loop do match = @rules[query] rules << entry_to_rule(match, query) if !match.nil? && (ignore_private == false || match.private == false) index += 1 break if index >= parts.size query = parts[index] + DOT + query end rules end
Selects all the rules matching given hostame. If `ignore_private` is set to true, the algorithm will skip the rules that are flagged as private domain. Note that the rules will still be part of the loop. If you frequently need to access lists ignoring the private domains, you should create a list that doesn't include these domains setting the `private_domains: false` option when calling {.parse}. Note that this method is currently private, as you should not rely on it. Instead, the public interface is {#find}. The current internal algorithm allows to return all matching rules, but different data structures may not be able to do it, and instead would return only the match. For this reason, you should rely on {#find}. @param name [#to_s] the hostname @param ignore_private [Boolean] @return [Array<PublicSuffix::Rule::*>]
select
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/list.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/list.rb
Apache-2.0
def initialize(value:, length: nil, private: false) @value = value.to_s @length = length || @value.count(DOT) + 1 @private = private end
Initializes a new rule. @param value [String] @param private [Boolean]
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/rule.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/rule.rb
Apache-2.0
def match?(name) # Note: it works because of the assumption there are no # rules like foo.*.com. If the assumption is incorrect, # we need to properly walk the input and skip parts according # to wildcard component. diff = name.chomp(value) diff.empty? || diff.end_with?(DOT) end
Checks if this rule matches +name+. A domain name is said to match a rule if and only if all of the following conditions are met: - When the domain and rule are split into corresponding labels, that the domain contains as many or more labels than the rule. - Beginning with the right-most labels of both the domain and the rule, and continuing for all labels in the rule, one finds that for every pair, either they are identical, or that the label from the rule is "*". @see https://publicsuffix.org/list/ @example PublicSuffix::Rule.factory("com").match?("example.com") # => true PublicSuffix::Rule.factory("com").match?("example.net") # => false @param name [String] the domain name to check @return [Boolean]
match?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/rule.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/rule.rb
Apache-2.0
def decompose(*) raise NotImplementedError end
@abstract @param domain [#to_s] The domain name to decompose @return [Array<String, nil>]
decompose
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/rule.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/rule.rb
Apache-2.0
def decompose(domain) suffix = parts.join('\.') matches = domain.to_s.match(/^(.*)\.(#{suffix})$/) matches ? matches[1..2] : [nil, nil] end
Decomposes the domain name according to rule properties. @param domain [#to_s] The domain name to decompose @return [Array<String>] The array with [trd + sld, tld].
decompose
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/rule.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/rule.rb
Apache-2.0
def initialize(value:, length: nil, private: false) super(value: value, length: length, private: private) length or @length += 1 # * counts as 1 end
Initializes a new rule. @param value [String] @param length [Integer] @param private [Boolean]
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/rule.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/rule.rb
Apache-2.0
def rule value == "" ? STAR : STAR + DOT + value end
Gets the original rule definition. @return [String] The rule definition.
rule
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/rule.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/rule.rb
Apache-2.0
def decompose(domain) suffix = ([".*?"] + parts).join('\.') matches = domain.to_s.match(/^(.*)\.(#{suffix})$/) matches ? matches[1..2] : [nil, nil] end
Decomposes the domain name according to rule properties. @param domain [#to_s] The domain name to decompose @return [Array<String>] The array with [trd + sld, tld].
decompose
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/rule.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/rule.rb
Apache-2.0
def rule BANG + value end
Gets the original rule definition. @return [String] The rule definition.
rule
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/rule.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/rule.rb
Apache-2.0
def decompose(domain) suffix = parts.join('\.') matches = domain.to_s.match(/^(.*)\.(#{suffix})$/) matches ? matches[1..2] : [nil, nil] end
Decomposes the domain name according to rule properties. @param domain [#to_s] The domain name to decompose @return [Array<String>] The array with [trd + sld, tld].
decompose
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/rule.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/lib/public_suffix/rule.rb
Apache-2.0
def test_self_domain assert_equal "google.com", PublicSuffix.domain("google.com") assert_equal "google.com", PublicSuffix.domain("www.google.com") assert_equal "google.co.uk", PublicSuffix.domain("google.co.uk") assert_equal "google.co.uk", PublicSuffix.domain("www.google.co.uk") end
def test_self_valid_with_fully_qualified_domain_name assert PublicSuffix.valid?("google.com.") assert PublicSuffix.valid?("google.co.uk.") assert !PublicSuffix.valid?("google.tldnotlisted.") end
test_self_domain
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/test/unit/public_suffix_test.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/public_suffix-4.0.7/test/unit/public_suffix_test.rb
Apache-2.0
def compute_useless @symboltable.each_terminal {|sym| sym.useless = false } @symboltable.each_nonterminal {|sym| sym.useless = true } @rules.each {|rule| rule.useless = true } r = @rules.dup s = @symboltable.nonterminals begin rs = r.size ss = s.size check_rules_useless r check_symbols_useless s end until r.size == rs and s.size == ss end
Sym#useless?, Rule#useless? FIXME: what means "useless"?
compute_useless
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/racc-1.6.2/lib/racc/grammar.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/racc-1.6.2/lib/racc/grammar.rb
Apache-2.0
def next_token raise NotImplementedError, "#{self.class}\#next_token is not defined" end
The method to fetch next token. If you use #do_parse method, you must implement #next_token. The format of return value is [TOKEN_SYMBOL, VALUE]. +token-symbol+ is represented by Ruby's symbol by default, e.g. :IDENT for 'IDENT'. ";" (String) for ';'. The final symbol (End of file) must be false.
next_token
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/racc-1.6.2/lib/racc/parser.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/racc-1.6.2/lib/racc/parser.rb
Apache-2.0
def on_error(t, val, vstack) raise ParseError, sprintf("\nparse error on value %s (%s)", val.inspect, token_to_str(t) || '?') end
This method is called when a parse error is found. ERROR_TOKEN_ID is an internal ID of token which caused error. You can get string representation of this ID by calling #token_to_str. ERROR_VALUE is a value of error token. value_stack is a stack of symbol values. DO NOT MODIFY this object. This method raises ParseError by default. If this method returns, parsers enter "error recovering mode".
on_error
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/racc-1.6.2/lib/racc/parser.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/racc-1.6.2/lib/racc/parser.rb
Apache-2.0
def yyerror throw :racc_jump, 1 end
Enter error recovering mode. This method does not call #on_error.
yyerror
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/racc-1.6.2/lib/racc/parser.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/racc-1.6.2/lib/racc/parser.rb
Apache-2.0
def background(*values) wrap_with_sgr(Color.build(:background, values).codes) end
Sets background color of this text.
background
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/rainbow-3.1.1/lib/rainbow/presenter.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rainbow-3.1.1/lib/rainbow/presenter.rb
Apache-2.0
def method_missing(method_name, *args) if Color::X11Named.color_names.include?(method_name) && args.empty? color(method_name) else super end end
We take care of X11 color method call here. Such as #aqua, #ghostwhite.
method_missing
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/rainbow-3.1.1/lib/rainbow/presenter.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rainbow-3.1.1/lib/rainbow/presenter.rb
Apache-2.0
def watcher @watcher ||= @notifier.watchers[@watcher_id] end
Returns the {Watcher} that fired this event. @return [Watcher]
watcher
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/event.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/event.rb
Apache-2.0
def absolute_name return watcher.path if name.empty? return File.join(watcher.path, name) end
The absolute path of the file that the event occurred on. This is actually only as absolute as the path passed to the {Watcher} that created this event. However, it is relative to the working directory, assuming that hasn't changed since the watcher started. @return [String]
absolute_name
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/event.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/event.rb
Apache-2.0
def flags @flags ||= Native::Flags.from_mask(@native[:mask]) end
Returns the flags that describe this event. This is generally similar to the input to {Notifier#watch}, except that it won't contain options flags nor `:all_events`, and it may contain one or more of the following flags: `:unmount` : The filesystem containing the watched file or directory was unmounted. `:ignored` : The \{#watcher watcher} was closed, or the watched file or directory was deleted. `:isdir` : The subject of this event is a directory. @return [Array<Symbol>]
flags
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/event.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/event.rb
Apache-2.0
def initialize(data, notifier) ptr = FFI::MemoryPointer.from_string(data) @native = Native::Event.new(ptr) @related = [] @cookie = @native[:cookie] @name = fix_encoding(data[@native.size, @native[:len]].gsub(/\0+$/, '')) @notifier = notifier @watcher_id = @native[:wd] raise QueueOverflowError.new("inotify event queue has overflowed.") if @native[:mask] & Native::Flags::IN_Q_OVERFLOW != 0 end
Creates an event from a string of binary data. Differs from {Event.consume} in that it doesn't modify the string. @private @param data [String] The data string @param notifier [Notifier] The {Notifier} that fired the event
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/event.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/event.rb
Apache-2.0
def callback! watcher && watcher.callback!(self) end
Calls the callback of the watcher that fired this event, passing in the event itself. @private
callback!
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/event.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/event.rb
Apache-2.0
def size @native.size + @native[:len] end
Returns the size of this event object in bytes, including the \{#name} string. @return [Fixnum]
size
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/event.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/event.rb
Apache-2.0
def initialize @running = Mutex.new @pipe = IO.pipe # JRuby shutdown sometimes runs IO finalizers before all threads finish. if RUBY_ENGINE == 'jruby' @pipe[0].autoclose = false @pipe[1].autoclose = false end @watchers = {} fd = Native.inotify_init unless fd < 0 @handle = IO.new(fd) @handle.autoclose = false if RUBY_ENGINE == 'jruby' return end raise SystemCallError.new( "Failed to initialize inotify" + case FFI.errno when Errno::EMFILE::Errno; ": the user limit on the total number of inotify instances has been reached." when Errno::ENFILE::Errno; ": the system limit on the total number of file descriptors has been reached." when Errno::ENOMEM::Errno; ": insufficient kernel memory is available." else; "" end, FFI.errno) end
Creates a new {Notifier}. @return [Notifier] @raise [SystemCallError] if inotify failed to initialize for some reason
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb
Apache-2.0
def watch(path, *flags, &callback) return Watcher.new(self, path, *flags, &callback) unless flags.include?(:recursive) dir = Dir.new(path) dir.each do |base| d = File.join(path, base) binary_d = d.respond_to?(:force_encoding) ? d.dup.force_encoding('BINARY') : d next if binary_d =~ /\/\.\.?$/ # Current or parent directory next if RECURSIVE_BLACKLIST.include?(d) next if flags.include?(:dont_follow) && File.symlink?(d) next if !File.directory?(d) watch(d, *flags, &callback) end dir.close rec_flags = [:create, :moved_to] return watch(path, *((flags - [:recursive]) | rec_flags)) do |event| callback.call(event) if flags.include?(:all_events) || !(flags & event.flags).empty? next if (rec_flags & event.flags).empty? || !event.flags.include?(:isdir) begin watch(event.absolute_name, *flags, &callback) rescue Errno::ENOENT # If the file has been deleted since the glob was run, we don't want to error out. end end end
Watches a file or directory for changes, calling the callback when there are. This is only activated once \{#process} or \{#run} is called. **Note that by default, this does not recursively watch subdirectories of the watched directory**. To do so, use the `:recursive` flag. ## Flags `:access` : A file is accessed (that is, read). `:attrib` : A file's metadata is changed (e.g. permissions, timestamps, etc). `:close_write` : A file that was opened for writing is closed. `:close_nowrite` : A file that was not opened for writing is closed. `:modify` : A file is modified. `:open` : A file is opened. ### Directory-Specific Flags These flags only apply when a directory is being watched. `:moved_from` : A file is moved out of the watched directory. `:moved_to` : A file is moved into the watched directory. `:create` : A file is created in the watched directory. `:delete` : A file is deleted in the watched directory. `:delete_self` : The watched file or directory itself is deleted. `:move_self` : The watched file or directory itself is moved. ### Helper Flags These flags are just combinations of the flags above. `:close` : Either `:close_write` or `:close_nowrite` is activated. `:move` : Either `:moved_from` or `:moved_to` is activated. `:all_events` : Any event above is activated. ### Options Flags These flags don't actually specify events. Instead, they specify options for the watcher. `:onlydir` : Only watch the path if it's a directory. `:dont_follow` : Don't follow symlinks. `:mask_add` : Add these flags to the pre-existing flags for this path. `:oneshot` : Only send the event once, then shut down the watcher. `:recursive` : Recursively watch any subdirectories that are created. Note that this is a feature of rb-inotify, rather than of inotify itself, which can only watch one level of a directory. This means that the {Event#name} field will contain only the basename of the modified file. When using `:recursive`, {Event#absolute_name} should always be used. @param path [String] The path to the file or directory @param flags [Array<Symbol>] Which events to watch for @yield [event] A block that will be called whenever one of the specified events occur @yieldparam event [Event] The Event object containing information about the event that occured @return [Watcher] A Watcher set up to watch this path for these events @raise [SystemCallError] if the file or directory can't be watched, e.g. if the file isn't found, read access is denied, or the flags don't contain any events
watch
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb
Apache-2.0
def run @running.synchronize do Thread.current[:INOTIFY_RUN_THREAD] = true @stop = false process until @stop end ensure Thread.current[:INOTIFY_RUN_THREAD] = false end
Starts the notifier watching for filesystem events. Blocks until \{#stop} is called. @see #process
run
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb
Apache-2.0
def stop @stop = true @pipe.last.write "." unless Thread.current[:INOTIFY_RUN_THREAD] @running.synchronize do # no-op: we just needed to wait until the lock was available end end end
Stop watching for filesystem events. That is, if we're in a \{#run} loop, exit out as soon as we finish handling the events.
stop
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb
Apache-2.0
def process read_events.each do |event| event.callback! event.flags.include?(:ignored) && event.notifier.watchers.delete(event.watcher_id) end end
Blocks until there are one or more filesystem events that this notifier has watchers registered for. Once there are events, the appropriate callbacks are called and this function returns. @see #run
process
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb
Apache-2.0
def close stop @handle.close @watchers.clear end
Close the notifier. @raise [SystemCallError] if closing the underlying file descriptor fails.
close
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb
Apache-2.0
def read_events size = Native::Event.size + Native.fpathconf(fd, Native::Flags::PC_NAME_MAX) + 1 tries = 1 begin data = readpartial(size) rescue SystemCallError => er # EINVAL means that there's more data to be read # than will fit in the buffer size raise er unless er.errno == Errno::EINVAL::Errno && tries < 5 size *= 2 tries += 1 retry end return [] if data.nil? events = [] cookies = {} while event = Event.consume(data, self) events << event next if event.cookie == 0 cookies[event.cookie] ||= [] cookies[event.cookie] << event end cookies.each {|c, evs| evs.each {|ev| ev.related.replace(evs - [ev]).freeze}} events end
Blocks until there are one or more filesystem events that this notifier has watchers registered for. Once there are events, returns their {Event} objects. This can return an empty list if the watcher was closed elsewhere. {#run} or {#process} are ususally preferable to calling this directly.
read_events
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb
Apache-2.0
def readpartial(size) readable, = select([@handle, @pipe.first]) return nil if readable.include?(@pipe.first) @handle.readpartial(size) rescue Errno::EBADF # If the IO has already been closed, reading from it will cause # Errno::EBADF. nil end
Same as IO#readpartial, or as close as we need.
readpartial
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb
Apache-2.0
def close if Native.inotify_rm_watch(@notifier.fd, @id) == 0 @notifier.watchers.delete(@id) return end raise SystemCallError.new("Failed to stop watching #{path.inspect}", FFI.errno) end
Disables this Watcher, so that it doesn't fire any more events. @raise [SystemCallError] if the watch fails to be disabled for some reason
close
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/watcher.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/watcher.rb
Apache-2.0
def initialize(notifier, path, *flags, &callback) @notifier = notifier @callback = callback || proc {} @path = path @flags = flags.freeze @id = Native.inotify_add_watch(@notifier.fd, path.dup, Native::Flags.to_mask(flags)) unless @id < 0 @notifier.watchers[@id] = self return end raise SystemCallError.new( "Failed to watch #{path.inspect}" + case FFI.errno when Errno::EACCES::Errno; ": read access to the given file is not permitted." when Errno::EBADF::Errno; ": the given file descriptor is not valid." when Errno::EFAULT::Errno; ": path points outside of the process's accessible address space." when Errno::EINVAL::Errno; ": the given event mask contains no legal events; or fd is not an inotify file descriptor." when Errno::ENOMEM::Errno; ": insufficient kernel memory was available." when Errno::ENOSPC::Errno; ": The user limit on the total number of inotify watches was reached or the kernel failed to allocate a needed resource." else; "" end, FFI.errno) end
Creates a new {Watcher}. @private @see Notifier#watch
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/watcher.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rb-inotify-0.10.1/lib/rb-inotify/watcher.rb
Apache-2.0
def break_literal(token) lead, last, _ = token.text.partition(/.\z/mu) return if lead.empty? token_1 = Regexp::Token.new(:literal, :literal, lead, token.ts, (token.te - last.length), nesting, set_nesting, conditional_nesting) token_2 = Regexp::Token.new(:literal, :literal, last, (token.ts + lead.length), token.te, nesting, set_nesting, conditional_nesting) token_1.previous = preprev_token token_1.next = token_2 token_2.previous = token_1 # .next will be set by #lex [token_1, token_2] end
called by scan to break a literal run that is longer than one character into two separate tokens when it is followed by a quantifier
break_literal
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/lexer.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/lexer.rb
Apache-2.0
def break_codepoint_list(token) lead, _, tail = token.text.rpartition(' ') return if lead.empty? token_1 = Regexp::Token.new(:escape, :codepoint_list, lead + '}', token.ts, (token.te - tail.length), nesting, set_nesting, conditional_nesting) token_2 = Regexp::Token.new(:escape, :codepoint_list, '\u{' + tail, (token.ts + lead.length + 1), (token.te + 3), nesting, set_nesting, conditional_nesting) self.shift = shift + 3 # one space less, but extra \, u, {, and } token_1.previous = preprev_token token_1.next = token_2 token_2.previous = token_1 # .next will be set by #lex [token_1, token_2] end
if a codepoint list is followed by a quantifier, that quantifier applies to the last codepoint, e.g. /\u{61 62 63}{3}/ =~ 'abccc' c.f. #break_literal.
break_codepoint_list
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/lexer.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/lexer.rb
Apache-2.0
def assign_referenced_expressions # find all referencable and refering expressions targets = { 0 => root } referrers = [] root.each_expression do |exp| exp.is_a?(Group::Capture) && targets[exp.identifier] = exp referrers << exp if exp.referential? end # assign reference expression to refering expressions # (in a second iteration because there might be forward references) referrers.each do |exp| exp.referenced_expression = targets[exp.reference] || raise(ParserError, "Invalid reference #{exp.reference} at pos #{exp.ts}") end end
Assigns referenced expressions to refering expressions, e.g. if there is an instance of Backreference::Number, its #referenced_expression is set to the instance of Group::Capture that it refers to via its number.
assign_referenced_expressions
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/parser.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/parser.rb
Apache-2.0
def quantity return [nil,nil] unless quantified? [quantifier.min, quantifier.max] end
Deprecated. Prefer `#repetitions` which has a more uniform interface.
quantity
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/base.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/base.rb
Apache-2.0
def initialize_copy(orig) self.expressions = orig.expressions.map do |exp| exp.clone.tap { |copy| copy.parent = self } end super end
Override base method to clone the expressions as well.
initialize_copy
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/subexpression.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/subexpression.rb
Apache-2.0
def reference ref = text.tr("'<>()", "") ref =~ /\D/ ? ref : Integer(ref) end
Name or number of the referenced capturing group that determines state. Returns a String if reference is by name, Integer if by number.
reference
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/classes/conditional.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/classes/conditional.rb
Apache-2.0
def construct(params = {}) attrs = construct_defaults.merge(params) options = attrs.delete(:options) token_args = Regexp::TOKEN_KEYS.map { |k| attrs.delete(k) } token = Regexp::Token.new(*token_args) raise ArgumentError, "unsupported attribute(s): #{attrs}" if attrs.any? new(token, options) end
Convenience method to init a valid Expression without a Regexp::Token
construct
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/construct.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/construct.rb
Apache-2.0
def human_name [token, type].compact.join(' ').tr('_', ' ') end
default implementation, e.g. "atomic group", "hex escape", "word type", ..
human_name
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/human_name.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/human_name.rb
Apache-2.0
def pretty_print_instance_variables [ (:@text unless text.to_s.empty?), (:@quantifier if quantified?), (:@options unless options.empty?), (:@expressions unless terminal?), ].compact end
Called by pretty_print (ruby/pp) and #inspect.
pretty_print_instance_variables
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/printing.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/printing.rb
Apache-2.0
def strfregexp(format = '%a', indent_offset = 0, index = nil) have_index = index ? true : false part = {} print_level = nesting_level > 0 ? nesting_level - 1 : nil # Order is important! Fields that use other fields in their # definition must appear before the fields they use. part_keys = %w[a m b o i l x s e S y k c q Q z Z t ~t T >] part.keys.each {|k| part[k] = "<?#{k}?>"} part['>'] = print_level ? (' ' * (print_level + indent_offset)) : '' part['l'] = print_level ? "#{'%d' % print_level}" : 'root' part['x'] = "#{'%d' % index}" if have_index part['s'] = starts_at part['S'] = full_length part['e'] = starts_at + full_length part['o'] = coded_offset part['k'] = token part['y'] = type part['i'] = '%y:%k' part['c'] = self.class.name if quantified? if quantifier.max == -1 part['q'] = "{#{quantifier.min}, or-more}" else part['q'] = "{#{quantifier.min}, #{quantifier.max}}" end part['Q'] = quantifier.text part['z'] = quantifier.min part['Z'] = quantifier.max else part['q'] = '{1}' part['Q'] = '' part['z'] = '1' part['Z'] = '1' end part['t'] = to_s(:base) part['~t'] = terminal? ? to_s : "#{type}:#{token}" part['T'] = to_s(:full) part['b'] = '%o %i' part['m'] = '%b %q' part['a'] = '%m %t' out = format.dup part_keys.each do |k| out.gsub!(/%#{k}/, part[k].to_s) end out end
%l Level (depth) of the expression. Returns 'root' for the root expression, returns zero or higher for all others. %> Indentation at expression's level. %x Index of the expression at its depth. Available when using the sprintf_tree method only. %s Start offset within the whole expression. %e End offset within the whole expression. %S Length of expression. %o Coded offset and length, same as '@%s+%S' %y Type of expression. %k Token of expression. %i ID, same as '%y:%k' %c Class name %q Quantifier info, as {m[,M]} %Q Quantifier text %z Quantifier min %Z Quantifier max %t Base text of the expression (excludes quantifier, if any) %~t Full text if the expression is terminal, otherwise %i %T Full text of the expression (includes quantifier, if any) %b Basic info, same as '%o %i' %m Most info, same as '%b %q' %a All info, same as '%m %t'
strfregexp
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/strfregexp.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/strfregexp.rb
Apache-2.0
def type?(test_type) test_types = Array(test_type).map(&:to_sym) test_types.include?(:*) || test_types.include?(type) end
Test if this expression has the given test_type, which can be either a symbol or an array of symbols to check against the expression's type. # is it a :group expression exp.type? :group # is it a :set, or :meta exp.type? [:set, :meta]
type?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/tests.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/tests.rb
Apache-2.0
def is?(test_token, test_type = nil) return true if test_token === :* token == test_token and (test_type ? type?(test_type) : true) end
Test if this expression has the given test_token, and optionally a given test_type. # Any expressions exp.is? :* # always returns true # is it a :capture exp.is? :capture # is it a :character and a :set exp.is? :character, :set # is it a :meta :dot exp.is? :dot, :meta # is it a :meta or :escape :dot exp.is? :dot, [:meta, :escape]
is?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/tests.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/tests.rb
Apache-2.0
def one_of?(scope, top = true) case scope when Array scope.include?(:*) || scope.include?(token) when Hash if scope.has_key?(:*) test_type = scope.has_key?(type) ? type : :* one_of?(scope[test_type], false) else scope.has_key?(type) && one_of?(scope[type], false) end when Symbol scope.equal?(:*) || (top ? type?(scope) : is?(scope)) else raise ArgumentError, "Array, Hash, or Symbol expected, #{scope.class.name} given" end end
Test if this expression matches an entry in the given scope spec. A scope spec can be one of: . An array: Interpreted as a set of tokens, tested for inclusion of the expression's token. . A hash: Where the key is interpreted as the expression type and the value is either a symbol or an array. In this case, when the scope is a hash, one_of? calls itself to evaluate the key's value. . A symbol: matches the expression's token or type, depending on the level of the call. If one_of? is called directly with a symbol then it will always be checked against the type of the expression. If it's being called for a value from a hash, it will be checked against the token of the expression. # any expression exp.one_of?(:*) # always true # like exp.type?(:group) exp.one_of?(:group) # any expression of type meta exp.one_of?(:meta => :*) # meta dots and alternations exp.one_of?(:meta => [:dot, :alternation]) # meta dots and any set tokens exp.one_of?({meta: [:dot], set: :*})
one_of?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/tests.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/tests.rb
Apache-2.0
def each_expression(include_self = false, &block) return enum_for(__method__, include_self) unless block if block.arity == 1 block.call(self) if include_self each_expression_without_index(&block) else block.call(self, 0) if include_self each_expression_with_index(&block) end end
Traverses the expression, passing each recursive child to the given block. If the block takes two arguments, the indices of the children within their parents are also passed to it.
each_expression
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/traverse.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/traverse.rb
Apache-2.0
def traverse(include_self = false, &block) return enum_for(__method__, include_self) unless block_given? block.call(:enter, self, 0) if include_self each_with_index do |exp, index| if exp.terminal? block.call(:visit, exp, index) else block.call(:enter, exp, index) exp.traverse(&block) block.call(:exit, exp, index) end end block.call(:exit, self, 0) if include_self self end
Traverses the subexpression (depth-first, pre-order) and calls the given block for each expression with three arguments; the traversal event, the expression, and the index of the expression within its parent. The event argument is passed as follows: - For subexpressions, :enter upon entering the subexpression, and :exit upon exiting it. - For terminal expressions, :visit is called once. Returns self.
traverse
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/traverse.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/traverse.rb
Apache-2.0
def flat_map(include_self = false, &block) case block && block.arity when nil then each_expression(include_self).to_a when 2 then each_expression(include_self).map(&block) else each_expression(include_self).map { |exp| block.call(exp) } end end
Returns a new array with the results of calling the given block once for every expression. If a block is not given, returns an array with each expression and its level index as an array.
flat_map
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/traverse.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/expression/methods/traverse.rb
Apache-2.0
def inherited(subclass) super subclass.features = features.to_h.map { |k, v| [k, v.dup] }.to_h end
automatically inherit features through the syntax class hierarchy
inherited
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/syntax/base.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/syntax/base.rb
Apache-2.0
def initialize warn 'Using instances of Regexp::Parser::Syntax is deprecated ' \ "and will no longer be supported in v3.0.0." end
TODO: drop this backwards compatibility code in v3.0.0, do `private :new`
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/syntax/base.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/syntax/base.rb
Apache-2.0
def for(name) (@alias_map ||= {})[name] ||= version_class(name) end
Returns the syntax specification class for the given syntax version name. The special names 'any' and '*' return Syntax::Any.
for
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/syntax/version_lookup.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/regexp_parser-2.8.0/lib/regexp_parser/syntax/version_lookup.rb
Apache-2.0