Class: Onion::CircuitList

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

Overview

Onion::CircuitList is a list of Onion::Circuit objects.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ CircuitList

Returns a new instance of CircuitList.



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

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

Instance Attribute Details

#circuitsObject (readonly)

Returns the value of attribute circuits.



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

def circuits
  @circuits
end