Class: Etwin::User::UserDisplayNameVersion
- Inherits:
-
Object
- Object
- Etwin::User::UserDisplayNameVersion
- Extended by:
- T::Helpers, T::Sig
- Defined in:
- lib/etwin/user/user_display_name_version.rb
Overview
Eternal-Twin user display name with metadata
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #as_json ⇒ Object
- #hash ⇒ Object
-
#initialize(value) ⇒ UserDisplayNameVersion
constructor
A new instance of UserDisplayNameVersion.
- #inspect ⇒ Object
- #pretty_print(pp) ⇒ Object
- #to_json(opts = nil) ⇒ Object
Constructor Details
#initialize(value) ⇒ UserDisplayNameVersion
Returns a new instance of UserDisplayNameVersion.
17 18 19 20 |
# File 'lib/etwin/user/user_display_name_version.rb', line 17 def initialize(value) @value = T.let(value, UserDisplayName) freeze end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
14 15 16 |
# File 'lib/etwin/user/user_display_name_version.rb', line 14 def value @value end |
Class Method Details
.deserialize(raw) ⇒ Object
76 77 78 79 |
# File 'lib/etwin/user/user_display_name_version.rb', line 76 def deserialize(raw) value = UserDisplayName.new(raw['value']) new(value) end |
.from_json(json_str) ⇒ Object
71 72 73 |
# File 'lib/etwin/user/user_display_name_version.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_version.rb', line 23 def ==(other) case other when UserDisplayNameVersion @value == other.value else false end end |
#as_json ⇒ Object
44 45 46 47 48 |
# File 'lib/etwin/user/user_display_name_version.rb', line 44 def as_json { 'value' => @value.as_json } end |
#hash ⇒ Object
33 34 35 |
# File 'lib/etwin/user/user_display_name_version.rb', line 33 def hash [@value].hash end |
#inspect ⇒ Object
51 52 53 |
# File 'lib/etwin/user/user_display_name_version.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_version.rb', line 56 def pretty_print(pp) pp.group(0, "#{self.class.name}(", ')') do pp.nest 1 do pp.breakable '' pp.text 'value=' pp.pp @value end pp.breakable '' end end |
#to_json(opts = nil) ⇒ Object
39 40 41 |
# File 'lib/etwin/user/user_display_name_version.rb', line 39 def to_json(opts = nil) JSON.generate(as_json, opts) end |