Class: E621ExportDownloader::Models::WikiPage
- Inherits:
-
Object
- Object
- E621ExportDownloader::Models::WikiPage
- Extended by:
- T::Sig
- Defined in:
- lib/e621_export_downloader/models/wiki_page.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#creator_id ⇒ Object
readonly
Returns the value of attribute creator_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#is_locked ⇒ Object
readonly
Returns the value of attribute is_locked.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#uploader_id ⇒ Object
readonly
Returns the value of attribute uploader_id.
Instance Method Summary collapse
-
#initialize(record) ⇒ WikiPage
constructor
A new instance of WikiPage.
- #to_json(*_args) ⇒ Object
Constructor Details
#initialize(record) ⇒ WikiPage
Returns a new instance of WikiPage.
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 34 def initialize(record) @record = T.let(record, T::Hash[String, String]) @body = T.let(T.must(record["body"]).gsub("\r\n", "\n"), String) @created_at = T.let(DateTime.parse(record["created_at"]), DateTime) @creator_id = T.let(T.must(record["creator_id"]).empty? ? nil : record["creator_id"].to_i, T.nilable(Integer)) @id = T.let(record["id"].to_i, Integer) @is_locked = T.let(record["is_locked"] == "t", T::Boolean) @title = T.let(T.must(record["title"]), String) @updated_at = T.let(T.must(record["updated_at"]).empty? ? nil : DateTime.parse(record["updated_at"]), T.nilable(DateTime)) @uploader_id = T.let(T.must(record["uploader_id"]).empty? ? nil : record["uploader_id"].to_i, T.nilable(Integer)) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
10 11 12 |
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 10 def body @body end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
13 14 15 |
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 13 def created_at @created_at end |
#creator_id ⇒ Object (readonly)
Returns the value of attribute creator_id.
16 17 18 |
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 16 def creator_id @creator_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
19 20 21 |
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 19 def id @id end |
#is_locked ⇒ Object (readonly)
Returns the value of attribute is_locked.
22 23 24 |
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 22 def is_locked @is_locked end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
25 26 27 |
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 25 def title @title end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
28 29 30 |
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 28 def updated_at @updated_at end |
#uploader_id ⇒ Object (readonly)
Returns the value of attribute uploader_id.
31 32 33 |
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 31 def uploader_id @uploader_id end |
Instance Method Details
#to_json(*_args) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/e621_export_downloader/models/wiki_page.rb', line 47 def to_json(*_args) { body: @body, created_at: @created_at, creator_id: @creator_id, id: @id, is_locked: @is_locked, title: @title, updated_at: @updated_at, uploader_id: @uploader_id, }.to_json end |