Class: Etwin::User::UserDisplayNameVersions
- Inherits:
-
Object
- Object
- Etwin::User::UserDisplayNameVersions
- Extended by:
- T::Helpers, T::Sig
- Defined in:
- lib/etwin/user/user_display_name_versions.rb
Overview
Potentially multi-valued Eternal-Twin user display name
Instance Attribute Summary collapse
-
#current ⇒ Object
readonly
Returns the value of attribute current.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #as_json ⇒ Object
- #hash ⇒ Object
-
#initialize(current) ⇒ UserDisplayNameVersions
constructor
A new instance of UserDisplayNameVersions.
- #inspect ⇒ Object
- #pretty_print(pp) ⇒ Object
- #to_json(opts = nil) ⇒ Object
Constructor Details
#initialize(current) ⇒ UserDisplayNameVersions
Returns a new instance of UserDisplayNameVersions.
17 18 19 20 |
# File 'lib/etwin/user/user_display_name_versions.rb', line 17 def initialize(current) @current = T.let(current, UserDisplayNameVersion) freeze end |
Instance Attribute Details
#current ⇒ Object (readonly)
Returns the value of attribute current.
14 15 16 |
# File 'lib/etwin/user/user_display_name_versions.rb', line 14 def current @current end |
Class Method Details
.deserialize(raw) ⇒ Object
76 77 78 79 |
# File 'lib/etwin/user/user_display_name_versions.rb', line 76 def deserialize(raw) current = UserDisplayNameVersion.deserialize(raw['current']) new(current) end |
.from_json(json_str) ⇒ Object
71 72 73 |
# File 'lib/etwin/user/user_display_name_versions.rb', line 71 def from_json(json_str) deserialize JSON.parse(json_str) end |
Instance Method Details
#==(other) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/etwin/user/user_display_name_versions.rb', line 23 def ==(other) case other when UserDisplayNameVersions @current == other.current else false end end |
#as_json ⇒ Object
44 45 46 47 48 |
# File 'lib/etwin/user/user_display_name_versions.rb', line 44 def as_json { 'current' => @current.as_json } end |
#hash ⇒ Object
33 34 35 |
# File 'lib/etwin/user/user_display_name_versions.rb', line 33 def hash [@current].hash end |
#inspect ⇒ Object
51 52 53 |
# File 'lib/etwin/user/user_display_name_versions.rb', line 51 def inspect PP.singleline_pp(self, String.new) end |
#pretty_print(pp) ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/etwin/user/user_display_name_versions.rb', line 56 def pretty_print(pp) pp.group(0, "#{self.class.name}(", ')') do pp.nest 1 do pp.breakable '' pp.text 'current=' pp.pp @current end pp.breakable '' end end |
#to_json(opts = nil) ⇒ Object
39 40 41 |
# File 'lib/etwin/user/user_display_name_versions.rb', line 39 def to_json(opts = nil) JSON.generate(as_json, opts) end |