Class: E621ExportDownloader::Models::PostVersion

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/e621_export_downloader/models/post_version.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record) ⇒ PostVersion

Returns a new instance of PostVersion.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/e621_export_downloader/models/post_version.rb', line 67

def initialize(record)
  @record              = T.let(record, T::Hash[String, String])
  inner                = T.must(T.must(record["added_locked_tags"])[1..-2])
  @added_locked_tags   = T.let(inner.empty? ? [] : inner.split(","), T::Array[String])
  inner                = T.must(T.must(record["added_tags"])[1..-2])
  @added_tags          = T.let(inner.empty? ? [] : inner.split(","), T::Array[String])
  @description         = T.let(T.must(record["description"]).empty? ? nil : record["description"], T.nilable(String))
  @description_changed = T.let(record["description_changed"] == "t", T::Boolean)
  @id                  = T.let(record["id"].to_i, Integer)
  @locked_tags         = T.let(T.must(record["locked_tags"]).empty? ? nil : record["locked_tags"], T.nilable(String))
  @parent_changed      = T.let(record["parent_changed"] == "t", T::Boolean)
  @parent_id           = T.let(T.must(record["parent_id"]).empty? ? nil : record["parent_id"].to_i, T.nilable(Integer))
  @rating              = T.let(T.must(record["rating"]).empty? ? nil : record["rating"], T.nilable(String))
  @rating_changed      = T.let(record["rating_changed"] == "t", T::Boolean)
  @reason              = T.let(T.must(record["reason"]).empty? ? nil : record["reason"], T.nilable(String))
  inner                = T.must(T.must(record["removed_locked_tags"])[1..-2])
  @removed_locked_tags = T.let(inner.empty? ? [] : inner.split(","), T::Array[String])
  inner                = T.must(T.must(record["removed_tags"])[1..-2])
  @removed_tags        = T.let(inner.empty? ? [] : inner.split(","), T::Array[String])
  @source              = T.let(T.must(record["source"]).empty? ? nil : record["source"], T.nilable(String))
  @source_changed      = T.let(record["source_changed"] == "t", T::Boolean)
  @tags                = T.let(T.must(record["tags"]).empty? ? nil : record["tags"], T.nilable(String))
  @updated_at          = T.let(DateTime.parse(record["updated_at"]), DateTime)
  @updater_id          = T.let(record["updater_id"].to_i, Integer)
  @version             = T.let(record["version"].to_i, Integer)
end

Instance Attribute Details

#added_locked_tagsObject (readonly)

Returns the value of attribute added_locked_tags.



10
11
12
# File 'lib/e621_export_downloader/models/post_version.rb', line 10

def added_locked_tags
  @added_locked_tags
end

#added_tagsObject (readonly)

Returns the value of attribute added_tags.



13
14
15
# File 'lib/e621_export_downloader/models/post_version.rb', line 13

def added_tags
  @added_tags
end

#descriptionObject (readonly)

Returns the value of attribute description.



16
17
18
# File 'lib/e621_export_downloader/models/post_version.rb', line 16

def description
  @description
end

#description_changedObject (readonly)

Returns the value of attribute description_changed.



19
20
21
# File 'lib/e621_export_downloader/models/post_version.rb', line 19

def description_changed
  @description_changed
end

#idObject (readonly)

Returns the value of attribute id.



22
23
24
# File 'lib/e621_export_downloader/models/post_version.rb', line 22

def id
  @id
end

#locked_tagsObject (readonly)

Returns the value of attribute locked_tags.



25
26
27
# File 'lib/e621_export_downloader/models/post_version.rb', line 25

def locked_tags
  @locked_tags
end

#parent_changedObject (readonly)

Returns the value of attribute parent_changed.



28
29
30
# File 'lib/e621_export_downloader/models/post_version.rb', line 28

def parent_changed
  @parent_changed
end

#parent_idObject (readonly)

Returns the value of attribute parent_id.



31
32
33
# File 'lib/e621_export_downloader/models/post_version.rb', line 31

def parent_id
  @parent_id
end

#ratingObject (readonly)

Returns the value of attribute rating.



34
35
36
# File 'lib/e621_export_downloader/models/post_version.rb', line 34

def rating
  @rating
end

#rating_changedObject (readonly)

Returns the value of attribute rating_changed.



37
38
39
# File 'lib/e621_export_downloader/models/post_version.rb', line 37

def rating_changed
  @rating_changed
end

#reasonObject (readonly)

Returns the value of attribute reason.



40
41
42
# File 'lib/e621_export_downloader/models/post_version.rb', line 40

def reason
  @reason
end

#removed_locked_tagsObject (readonly)

Returns the value of attribute removed_locked_tags.



43
44
45
# File 'lib/e621_export_downloader/models/post_version.rb', line 43

def removed_locked_tags
  @removed_locked_tags
end

#removed_tagsObject (readonly)

Returns the value of attribute removed_tags.



46
47
48
# File 'lib/e621_export_downloader/models/post_version.rb', line 46

def removed_tags
  @removed_tags
end

#sourceObject (readonly)

Returns the value of attribute source.



49
50
51
# File 'lib/e621_export_downloader/models/post_version.rb', line 49

def source
  @source
end

#source_changedObject (readonly)

Returns the value of attribute source_changed.



52
53
54
# File 'lib/e621_export_downloader/models/post_version.rb', line 52

def source_changed
  @source_changed
end

#tagsObject (readonly)

Returns the value of attribute tags.



55
56
57
# File 'lib/e621_export_downloader/models/post_version.rb', line 55

def tags
  @tags
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



58
59
60
# File 'lib/e621_export_downloader/models/post_version.rb', line 58

def updated_at
  @updated_at
end

#updater_idObject (readonly)

Returns the value of attribute updater_id.



61
62
63
# File 'lib/e621_export_downloader/models/post_version.rb', line 61

def updater_id
  @updater_id
end

#versionObject (readonly)

Returns the value of attribute version.



64
65
66
# File 'lib/e621_export_downloader/models/post_version.rb', line 64

def version
  @version
end

Instance Method Details

#to_json(*_args) ⇒ Object



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/e621_export_downloader/models/post_version.rb', line 95

def to_json(*_args)
  {
    added_locked_tags:   @added_locked_tags,
    added_tags:          @added_tags,
    description:         @description,
    description_changed: @description_changed,
    id:                  @id,
    locked_tags:         @locked_tags,
    parent_changed:      @parent_changed,
    parent_id:           @parent_id,
    rating:              @rating,
    rating_changed:      @rating_changed,
    reason:              @reason,
    removed_locked_tags: @removed_locked_tags,
    removed_tags:        @removed_tags,
    source:              @source,
    source_changed:      @source_changed,
    tags:                @tags,
    updated_at:          @updated_at,
    updater_id:          @updater_id,
    version:             @version,
  }.to_json
end