Class: Sevgi::Function::Location
- Inherits:
-
Data
- Object
- Data
- Sevgi::Function::Location
- Defined in:
- lib/sevgi/function/locate.rb
Overview
Found file location returned by locate helpers.
Instance Attribute Summary collapse
-
#dir ⇒ String
readonly
Directory where the match was found.
-
#file ⇒ String
readonly
Absolute matching file path.
-
#slug ⇒ String
readonly
Candidate path that matched.
Instance Method Summary collapse
-
#initialize(file:, slug:, dir:) ⇒ void
constructor
Creates an owned immutable location snapshot.
Constructor Details
#initialize(file:, slug:, dir:) ⇒ void
Creates an owned immutable location snapshot.
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
#dir ⇒ String (readonly)
Returns 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 |
#file ⇒ String (readonly)
Returns 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 |
#slug ⇒ String (readonly)
Returns 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 |