Module: Hsdq::Shared
- Included in:
- Hsdq
- Defined in:
- lib/hsdq/shared.rb
Overview
The methods in this module are shared by different modules
Instance Method Summary collapse
-
#burst_key(spark) ⇒ String
Build the namespaced key for the spark and burst unique shared uid.
-
#hsdq_key(message_or_spark) ⇒ String
Build the namespaced key for the main hash storing the message history (collection of 'burst').
- #placeholder ⇒ Object
-
#session_key(session_id) ⇒ String
Build the namespaced key for the main session hash.
- #valid_type?(type) ⇒ Boolean
Instance Method Details
#burst_key(spark) ⇒ String
Build the namespaced key for the spark and burst unique shared uid
27 28 29 30 |
# File 'lib/hsdq/shared.rb', line 27 def burst_key(spark) return unless spark "#{spark[:type]}_#{spark[:spark_uid]}" if spark[:type] && spark[:spark_uid] end |
#hsdq_key(message_or_spark) ⇒ String
Build the namespaced key for the main hash storing the message history (collection of 'burst')
18 19 20 21 |
# File 'lib/hsdq/shared.rb', line 18 def hsdq_key() return unless "hsdq_h_#{[:uid]}" if [:uid] end |
#placeholder ⇒ Object
6 7 8 |
# File 'lib/hsdq/shared.rb', line 6 def placeholder "This is a placeholder, you must implement this method in your hsdq class" end |
#session_key(session_id) ⇒ String
Build the namespaced key for the main session hash
36 37 38 39 |
# File 'lib/hsdq/shared.rb', line 36 def session_key(session_id) return unless session_id "hsdq_s_#{session_id}" end |
#valid_type?(type) ⇒ Boolean
10 11 12 |
# File 'lib/hsdq/shared.rb', line 10 def valid_type?(type) [:request, :ack, :callback, :feedback, :error].include? type.to_sym end |