Class: E621ExportDownloader::Models::Pool
- Inherits:
-
Object
- Object
- E621ExportDownloader::Models::Pool
- Extended by:
- T::Sig
- Defined in:
- lib/e621_export_downloader/models/pool.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#creator_id ⇒ Object
readonly
Returns the value of attribute creator_id.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#is_active ⇒ Object
readonly
Returns the value of attribute is_active.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#post_ids ⇒ Object
readonly
Returns the value of attribute post_ids.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Instance Method Summary collapse
-
#initialize(record) ⇒ Pool
constructor
A new instance of Pool.
- #to_json(*_args) ⇒ Object
Constructor Details
#initialize(record) ⇒ Pool
Returns a new instance of Pool.
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/e621_export_downloader/models/pool.rb', line 40 def initialize(record) @record = T.let(record, T::Hash[String, String]) @category = T.let(T.must(record["category"]), String) @created_at = T.let(DateTime.parse(record["created_at"]), DateTime) @creator_id = T.let(record["creator_id"].to_i, Integer) @description = T.let(T.must(record["description"]), String) @id = T.let(record["id"].to_i, Integer) @is_active = T.let(record["is_active"] == "t", T::Boolean) @name = T.let(T.must(record["name"]), String) @post_ids = T.let(T.must(T.must(record["post_ids"])[1..-2]).split(",").map(&:to_i), T::Array[Integer]) @updated_at = T.let(T.must(record["updated_at"]).empty? ? nil : DateTime.parse(record["updated_at"]), T.nilable(DateTime)) end |
Instance Attribute Details
#category ⇒ Object (readonly)
Returns the value of attribute category.
13 14 15 |
# File 'lib/e621_export_downloader/models/pool.rb', line 13 def category @category end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
16 17 18 |
# File 'lib/e621_export_downloader/models/pool.rb', line 16 def created_at @created_at end |
#creator_id ⇒ Object (readonly)
Returns the value of attribute creator_id.
19 20 21 |
# File 'lib/e621_export_downloader/models/pool.rb', line 19 def creator_id @creator_id end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
22 23 24 |
# File 'lib/e621_export_downloader/models/pool.rb', line 22 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
25 26 27 |
# File 'lib/e621_export_downloader/models/pool.rb', line 25 def id @id end |
#is_active ⇒ Object (readonly)
Returns the value of attribute is_active.
28 29 30 |
# File 'lib/e621_export_downloader/models/pool.rb', line 28 def is_active @is_active end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
31 32 33 |
# File 'lib/e621_export_downloader/models/pool.rb', line 31 def name @name end |
#post_ids ⇒ Object (readonly)
Returns the value of attribute post_ids.
34 35 36 |
# File 'lib/e621_export_downloader/models/pool.rb', line 34 def post_ids @post_ids end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
10 11 12 |
# File 'lib/e621_export_downloader/models/pool.rb', line 10 def record @record end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
37 38 39 |
# File 'lib/e621_export_downloader/models/pool.rb', line 37 def updated_at @updated_at end |
Instance Method Details
#to_json(*_args) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/e621_export_downloader/models/pool.rb', line 54 def to_json(*_args) { category: @category, created_at: @created_at, creator_id: @creator_id, description: @description, id: @id, is_active: @is_active, name: @name, post_ids: @post_ids, updated_at: @updated_at, }.to_json end |