Remove unnecessary path method

This commit is contained in:
Alex Ling 2022-05-22 05:17:05 +00:00
parent e6dbeb623b
commit 5b23a112b2
3 changed files with 4 additions and 12 deletions

View File

@ -9,6 +9,7 @@ class ArchiveEntry < Entry
def initialize(@zip_path, @book) def initialize(@zip_path, @book)
storage = Storage.default storage = Storage.default
@path = @zip_path
@encoded_path = URI.encode @zip_path @encoded_path = URI.encode @zip_path
@title = File.basename @zip_path, File.extname @zip_path @title = File.basename @zip_path, File.extname @zip_path
@encoded_title = URI.encode @title @encoded_title = URI.encode @title
@ -48,10 +49,6 @@ class ArchiveEntry < Entry
file.close file.close
end end
def path : String
@zip_path
end
private def sorted_archive_entries private def sorted_archive_entries
ArchiveFile.open @zip_path do |file| ArchiveFile.open @zip_path do |file|
entries = file.entries entries = file.entries

View File

@ -14,6 +14,7 @@ class DirEntry < Entry
def initialize(@dir_path, @book) def initialize(@dir_path, @book)
storage = Storage.default storage = Storage.default
@path = @dir_path
@encoded_path = URI.encode @dir_path @encoded_path = URI.encode @dir_path
@title = File.basename @dir_path @title = File.basename @dir_path
@encoded_title = URI.encode @title @encoded_title = URI.encode @title
@ -56,10 +57,6 @@ class DirEntry < Entry
@pages = sorted_files.size @pages = sorted_files.size
end end
def path : String
@dir_path
end
def read_page(page_num) def read_page(page_num)
img = nil img = nil
begin begin

View File

@ -1,12 +1,12 @@
require "image_size" require "image_size"
abstract class Entry abstract class Entry
getter id : String, book : Title, title : String, getter id : String, book : Title, title : String, path : String,
size : String, pages : Int32, mtime : Time, size : String, pages : Int32, mtime : Time,
encoded_path : String, encoded_title : String, err_msg : String? encoded_path : String, encoded_title : String, err_msg : String?
def initialize( def initialize(
@id, @title, @book, @id, @title, @book, @path,
@size, @pages, @mtime, @size, @pages, @mtime,
@encoded_path, @encoded_title, @err_msg @encoded_path, @encoded_title, @err_msg
) )
@ -229,8 +229,6 @@ abstract class Entry
extend ClassMethods extend ClassMethods
end end
abstract def path : String
abstract def read_page(page_num) abstract def read_page(page_num)
abstract def page_dimensions abstract def page_dimensions