Class: Pluggaloid::Identity
- Inherits:
-
Object
- Object
- Pluggaloid::Identity
- Defined in:
- lib/pluggaloid/identity.rb
Overview
slugと名前をもつオブジェクト。これの参照を直接持たずとも、slugで一意に参照したり、表示名を設定することができる
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#slug ⇒ Object
readonly
Returns the value of attribute slug.
Instance Method Summary collapse
-
#initialize(slug: SecureRandom.uuid, name: slug) ⇒ Identity
constructor
Args [name:] 名前(String | nil) [slug:] ハンドラスラッグ(Symbol | nil).
- #inspect ⇒ Object
Constructor Details
#initialize(slug: SecureRandom.uuid, name: slug) ⇒ Identity
Args
- name:
-
名前(String | nil)
- slug:
-
ハンドラスラッグ(Symbol | nil)
13 14 15 16 |
# File 'lib/pluggaloid/identity.rb', line 13 def initialize(slug: SecureRandom.uuid, name: slug) @name = name.to_s.freeze @slug = slug.to_sym end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/pluggaloid/identity.rb', line 8 def name @name end |
#slug ⇒ Object (readonly)
Returns the value of attribute slug.
8 9 10 |
# File 'lib/pluggaloid/identity.rb', line 8 def slug @slug end |
Instance Method Details
#inspect ⇒ Object
18 19 20 |
# File 'lib/pluggaloid/identity.rb', line 18 def inspect "#<#{self.class} slug: #{slug.inspect}, name: #{name.inspect}>" end |