Class: Onion::StreamList

Inherits:
Object
  • Object
show all
Defined in:
lib/onion/elements/stream_list.rb

Overview

Onion::StreamList is a list of Onion::Stream objects.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ StreamList

Returns a new instance of StreamList.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/onion/elements/stream_list.rb', line 5

def initialize(text)
  if text.blank?
    @streams = []
    return self
  end
  
  parser = Onion::StreamListsParser.new
  if nodes  = parser.parse(text)
    @streams = nodes.streams
  else
    raise Exception, "Couldn't parse #{text} b/c #{parser.failure_reason}."
  end
  
end

Instance Attribute Details

#streamsObject (readonly)

Returns the value of attribute streams.



4
5
6
# File 'lib/onion/elements/stream_list.rb', line 4

def streams
  @streams
end