Class: Wave::Blip

Inherits:
Object
  • Object
show all
Defined in:
lib/wave/blip.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Blip

Returns a new instance of Blip.

Raises:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/wave/blip.rb', line 19

def initialize(options = {})
  if options[:parent]
    @parent = options[:parent]
    @parent.children << self
    @wavelet = @parent.wavelet
  end
  @wavelet ||= options[:wavelet]
  raise Wave::WaveError, "Blip has no wavelet" unless @wavelet
  @creator = options[:creator]
  raise Wave::WaveError, "Blip has no creator" unless @creator
  @content = options[:content]
  @wavelet.blips << self
  @children ||= []
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



16
17
18
# File 'lib/wave/blip.rb', line 16

def children
  @children
end

#contentObject

Returns the value of attribute content.



17
18
19
# File 'lib/wave/blip.rb', line 17

def content
  @content
end

#creatorObject (readonly)

Returns the value of attribute creator.



16
17
18
# File 'lib/wave/blip.rb', line 16

def creator
  @creator
end

#documentObject

Returns the value of attribute document.



17
18
19
# File 'lib/wave/blip.rb', line 17

def document
  @document
end

#parentObject (readonly)

Returns the value of attribute parent.



16
17
18
# File 'lib/wave/blip.rb', line 16

def parent
  @parent
end

#waveletObject (readonly)

Returns the value of attribute wavelet.



16
17
18
# File 'lib/wave/blip.rb', line 16

def wavelet
  @wavelet
end

Instance Method Details

#root?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/wave/blip.rb', line 34

def root?
  self == wavelet.blips.first
end

#waveObject



38
39
40
# File 'lib/wave/blip.rb', line 38

def wave
  wavelet.wave
end