mirror of
https://github.com/hkalexling/Mango.git
synced 2026-04-25 00:00:52 -04:00
Use is_valid?
This commit is contained in:
+11
-2
@@ -28,8 +28,7 @@ abstract class Entry
|
||||
if err_msg
|
||||
json.field "err_msg", err_msg
|
||||
end
|
||||
# for API backward compatability
|
||||
json.field "zip_path", path
|
||||
json.field "zip_path", path # for API backward compatability
|
||||
json.field "title_id", @book.id
|
||||
json.field "title_title", @book.title
|
||||
json.field "sort_title", sort_title
|
||||
@@ -220,6 +219,16 @@ abstract class Entry
|
||||
date_added.not_nil! # is it ok to set not_nil! here?
|
||||
end
|
||||
|
||||
# Hack to have abstract class methods
|
||||
# https://github.com/crystal-lang/crystal/issues/5956
|
||||
private module ClassMethods
|
||||
abstract def is_valid?(path : String) : Bool
|
||||
end
|
||||
|
||||
macro inherited
|
||||
extend ClassMethods
|
||||
end
|
||||
|
||||
abstract def path : String
|
||||
|
||||
abstract def read_page(page_num)
|
||||
|
||||
Reference in New Issue
Block a user