Module: Vident::Capabilities::Identifiable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Vident::Component
- Defined in:
- lib/vident/capabilities/identifiable.rb
Instance Method Summary collapse
- #component_name ⇒ Object
-
#id ⇒ Object
‘.presence` is intentional — blank string falls through to auto-generation.
- #outlet_id ⇒ Object
- #random_id ⇒ Object
- #stimulus_identifier ⇒ Object
Instance Method Details
#component_name ⇒ Object
25 |
# File 'lib/vident/capabilities/identifiable.rb', line 25 def component_name = self.class.component_name |
#id ⇒ Object
‘.presence` is intentional — blank string falls through to auto-generation.
32 33 34 |
# File 'lib/vident/capabilities/identifiable.rb', line 32 def id @id.presence || random_id end |
#outlet_id ⇒ Object
40 41 42 |
# File 'lib/vident/capabilities/identifiable.rb', line 40 def outlet_id @outlet_id ||= [stimulus_identifier, "##{id}"] end |
#random_id ⇒ Object
36 37 38 |
# File 'lib/vident/capabilities/identifiable.rb', line 36 def random_id @__vident_auto_id ||= "#{component_name}-#{::Vident::StableId.next_id_in_sequence}" end |
#stimulus_identifier ⇒ Object
27 |
# File 'lib/vident/capabilities/identifiable.rb', line 27 def stimulus_identifier = self.class.stimulus_identifier |