Class: Rave::Models::Wave
Overview
Represents a Wave
Constant Summary
Constants inherited from Component
Component::GENERATED_PATTERN, Component::GENERATED_PREFIX
Instance Attribute Summary
Attributes inherited from Component
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Wave
constructor
Options include: - :wavelet_ids - :id.
-
#print_structure(indent = 0) ⇒ Object
:nodoc:.
-
#root_wavelet ⇒ Object
The root wavelet (it will be nil if the event refers to a private subwavelet) [Wavelet].
-
#wavelet_ids ⇒ Object
IDs for all wavelets that are part of the wave [Array of String].
-
#wavelets ⇒ Object
All wavelets that are part of the wave [Array of Wavelet].
Methods inherited from Component
#generated?, #id, #to_s, #unique_id
Methods included from Rave::Mixins::Logger
Constructor Details
#initialize(options = {}) ⇒ Wave
Options include:
-
:wavelet_ids
-
:id
13 14 15 16 17 18 19 20 21 |
# File 'lib/models/wave.rb', line 13 def initialize( = {}) # :nodoc: if [:id].nil? and [:context] super(:id => "#{GENERATED_PREFIX}_wave_#{unique_id}", :context => [:context]) else super() end @wavelet_ids = [:wavelet_ids] || [] end |
Instance Method Details
#print_structure(indent = 0) ⇒ Object
:nodoc:
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/models/wave.rb', line 33 def print_structure(indent = 0) # :nodoc: str = '' str << "#{' ' * indent}Wave:#{@id}\n" wavelets.each do |wavelet| str << wavelet.print_structure(indent + 1) end str end |
#root_wavelet ⇒ Object
The root wavelet (it will be nil if the event refers to a private subwavelet) [Wavelet]
29 30 31 |
# File 'lib/models/wave.rb', line 29 def root_wavelet # :nodoc: wavelets.find { |wavelet| wavelet and wavelet.root? } end |
#wavelet_ids ⇒ Object
IDs for all wavelets that are part of the wave [Array of String]
6 7 8 |
# File 'lib/models/wave.rb', line 6 def wavelet_ids # :nodoc: @wavelet_ids.map { |id| id.dup } end |
#wavelets ⇒ Object
All wavelets that are part of the wave [Array of Wavelet]
24 25 26 |
# File 'lib/models/wave.rb', line 24 def wavelets # :nodoc: @wavelet_ids.map { |id| @context.wavelets[id] } end |