Class: Clowk::Current
- Inherits:
-
Object
- Object
- Clowk::Current
- Defined in:
- lib/clowk/current.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #[](key) ⇒ Object
- #app_id ⇒ Object
- #avatar_url ⇒ Object
- #email ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
- #id ⇒ Object
-
#initialize(attributes = {}) ⇒ Current
constructor
A new instance of Current.
- #instance_id ⇒ Object
- #name ⇒ Object
- #provider ⇒ Object
- #session_id ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Current
Returns a new instance of Current.
7 8 9 |
# File 'lib/clowk/current.rb', line 7 def initialize(attributes = {}) @attributes = attributes.to_h.deep_symbolize_keys end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/clowk/current.rb', line 5 def attributes @attributes end |
Instance Method Details
#==(other) ⇒ Object
51 52 53 54 55 |
# File 'lib/clowk/current.rb', line 51 def ==(other) return false unless other.is_a?(Current) to_h == other.to_h end |
#[](key) ⇒ Object
43 44 45 |
# File 'lib/clowk/current.rb', line 43 def [](key) attributes[key.to_sym] end |
#app_id ⇒ Object
35 36 37 |
# File 'lib/clowk/current.rb', line 35 def app_id attributes[:app_id] end |
#avatar_url ⇒ Object
23 24 25 |
# File 'lib/clowk/current.rb', line 23 def avatar_url attributes[:avatar_url] end |
#email ⇒ Object
15 16 17 |
# File 'lib/clowk/current.rb', line 15 def email attributes[:email] end |
#eql?(other) ⇒ Boolean
57 58 59 |
# File 'lib/clowk/current.rb', line 57 def eql?(other) self == other end |
#hash ⇒ Object
61 62 63 |
# File 'lib/clowk/current.rb', line 61 def hash to_h.hash end |
#id ⇒ Object
11 12 13 |
# File 'lib/clowk/current.rb', line 11 def id attributes[:sub] || attributes[:id] end |
#instance_id ⇒ Object
31 32 33 |
# File 'lib/clowk/current.rb', line 31 def instance_id attributes[:instance_id] end |
#name ⇒ Object
19 20 21 |
# File 'lib/clowk/current.rb', line 19 def name attributes[:name] end |
#provider ⇒ Object
27 28 29 |
# File 'lib/clowk/current.rb', line 27 def provider attributes[:provider] end |
#session_id ⇒ Object
39 40 41 |
# File 'lib/clowk/current.rb', line 39 def session_id attributes[:session_id] end |
#to_h ⇒ Object
47 48 49 |
# File 'lib/clowk/current.rb', line 47 def to_h attributes.merge(id: id) end |