Class: Pluggaloid::Identity

Inherits:
Object
  • Object
show all
Defined in:
lib/pluggaloid/identity.rb

Overview

slugと名前をもつオブジェクト。これの参照を直接持たずとも、slugで一意に参照したり、表示名を設定することができる

Direct Known Subclasses

Handler, HandlerTag

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/pluggaloid/identity.rb', line 8

def name
  @name
end

#slugObject (readonly)

Returns the value of attribute slug.



8
9
10
# File 'lib/pluggaloid/identity.rb', line 8

def slug
  @slug
end

Instance Method Details

#inspectObject



18
19
20
# File 'lib/pluggaloid/identity.rb', line 18

def inspect
  "#<#{self.class} slug: #{slug.inspect}, name: #{name.inspect}>"
end