Class: Exfuz::BookName
- Inherits:
-
Object
show all
- Includes:
- Util
- Defined in:
- lib/exfuz/book_name.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Util
#match?, wsl?, wsl_to_windows
Constructor Details
#initialize(file_name) ⇒ BookName
Returns a new instance of BookName.
15
16
17
|
# File 'lib/exfuz/book_name.rb', line 15
def initialize(file_name)
@absolute_path = @text = File.absolute_path(file_name)
end
|
Instance Attribute Details
#absolute_path ⇒ Object
Returns the value of attribute absolute_path.
11
12
13
|
# File 'lib/exfuz/book_name.rb', line 11
def absolute_path
@absolute_path
end
|
Class Method Details
.name ⇒ Object
7
8
9
|
# File 'lib/exfuz/book_name.rb', line 7
def self.name
:book_name
end
|
Instance Method Details
#==(other) ⇒ Object
19
20
21
|
# File 'lib/exfuz/book_name.rb', line 19
def ==(other)
absolute_path == other.absolute_path
end
|
#hash ⇒ Object
23
24
25
|
# File 'lib/exfuz/book_name.rb', line 23
def hash
absolute_path.hash
end
|
#jump_info ⇒ Object
31
32
33
34
|
# File 'lib/exfuz/book_name.rb', line 31
def jump_info
path = wsl? ? wsl_to_windows(@absolute_path) : @absolute_path
{ Exfuz::BookName.name => path }
end
|
#relative_path ⇒ Object
27
28
29
|
# File 'lib/exfuz/book_name.rb', line 27
def relative_path
Pathname.new(@absolute_path).relative_path_from(Dir.pwd).to_s
end
|