Class: Sevgi::Function::Location

Inherits:
Data
  • Object
show all
Defined in:
lib/sevgi/function/locate.rb

Overview

Found file location returned by locate helpers.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file:, slug:, dir:) ⇒ void

Creates an owned immutable location snapshot.

Parameters:

  • file (String)

    absolute matching file path

  • slug (String)

    candidate path that matched

  • dir (String)

    directory where the match was found



19
20
21
# File 'lib/sevgi/function/locate.rb', line 19

def initialize(file:, slug:, dir:)
  super(file: file.dup.freeze, slug: slug.dup.freeze, dir: dir.dup.freeze)
end

Instance Attribute Details

#dirString (readonly)

Returns directory where the match was found.

Returns:

  • (String)

    directory where the match was found



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/sevgi/function/locate.rb', line 13

Location = Data.define(:file, :slug, :dir) do
  # Creates an owned immutable location snapshot.
  # @param file [String] absolute matching file path
  # @param slug [String] candidate path that matched
  # @param dir [String] directory where the match was found
  # @return [void]
  def initialize(file:, slug:, dir:)
    super(file: file.dup.freeze, slug: slug.dup.freeze, dir: dir.dup.freeze)
  end

  private_class_method :[]
end

#fileString (readonly)

Returns absolute matching file path.

Returns:

  • (String)

    absolute matching file path



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/sevgi/function/locate.rb', line 13

Location = Data.define(:file, :slug, :dir) do
  # Creates an owned immutable location snapshot.
  # @param file [String] absolute matching file path
  # @param slug [String] candidate path that matched
  # @param dir [String] directory where the match was found
  # @return [void]
  def initialize(file:, slug:, dir:)
    super(file: file.dup.freeze, slug: slug.dup.freeze, dir: dir.dup.freeze)
  end

  private_class_method :[]
end

#slugString (readonly)

Returns candidate path that matched.

Returns:

  • (String)

    candidate path that matched



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/sevgi/function/locate.rb', line 13

Location = Data.define(:file, :slug, :dir) do
  # Creates an owned immutable location snapshot.
  # @param file [String] absolute matching file path
  # @param slug [String] candidate path that matched
  # @param dir [String] directory where the match was found
  # @return [void]
  def initialize(file:, slug:, dir:)
    super(file: file.dup.freeze, slug: slug.dup.freeze, dir: dir.dup.freeze)
  end

  private_class_method :[]
end