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