From 5b23a112b2ebbb236fed2826b08d67cf935c22f9 Mon Sep 17 00:00:00 2001 From: Alex Ling Date: Sun, 22 May 2022 05:17:05 +0000 Subject: [PATCH] Remove unnecessary `path` method --- src/library/archive_entry.cr | 5 +---- src/library/dir_entry.cr | 5 +---- src/library/entry.cr | 6 ++---- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/library/archive_entry.cr b/src/library/archive_entry.cr index da313cd..cd63f17 100644 --- a/src/library/archive_entry.cr +++ b/src/library/archive_entry.cr @@ -9,6 +9,7 @@ class ArchiveEntry < Entry def initialize(@zip_path, @book) storage = Storage.default + @path = @zip_path @encoded_path = URI.encode @zip_path @title = File.basename @zip_path, File.extname @zip_path @encoded_title = URI.encode @title @@ -48,10 +49,6 @@ class ArchiveEntry < Entry file.close end - def path : String - @zip_path - end - private def sorted_archive_entries ArchiveFile.open @zip_path do |file| entries = file.entries diff --git a/src/library/dir_entry.cr b/src/library/dir_entry.cr index 82b7ccc..0ce4e71 100644 --- a/src/library/dir_entry.cr +++ b/src/library/dir_entry.cr @@ -14,6 +14,7 @@ class DirEntry < Entry def initialize(@dir_path, @book) storage = Storage.default + @path = @dir_path @encoded_path = URI.encode @dir_path @title = File.basename @dir_path @encoded_title = URI.encode @title @@ -56,10 +57,6 @@ class DirEntry < Entry @pages = sorted_files.size end - def path : String - @dir_path - end - def read_page(page_num) img = nil begin diff --git a/src/library/entry.cr b/src/library/entry.cr index 131e489..2cb4562 100644 --- a/src/library/entry.cr +++ b/src/library/entry.cr @@ -1,12 +1,12 @@ require "image_size" 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, encoded_path : String, encoded_title : String, err_msg : String? def initialize( - @id, @title, @book, + @id, @title, @book, @path, @size, @pages, @mtime, @encoded_path, @encoded_title, @err_msg ) @@ -229,8 +229,6 @@ abstract class Entry extend ClassMethods end - abstract def path : String - abstract def read_page(page_num) abstract def page_dimensions