Class: Shift::InterfaceList
- Inherits:
-
Object
- Object
- Shift::InterfaceList
- Defined in:
- lib/shift/interface_list.rb
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(ifaces) ⇒ InterfaceList
constructor
Create a new InterfaceList, given an array of class names of shift interfaces.
- #inspect ⇒ Object
-
#pick ⇒ Class
Pick the preferred available interface.
- #to_hash ⇒ Object
Constructor Details
#initialize(ifaces) ⇒ InterfaceList
Create a new InterfaceList, given an array of class names of shift interfaces. Immutable once created.
7 8 9 |
# File 'lib/shift/interface_list.rb', line 7 def initialize(ifaces) @interfaces = ifaces end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
15 16 17 |
# File 'lib/shift/interface_list.rb', line 15 def eql?(other) @interfaces.eql? other.to_hash end |
#hash ⇒ Object
20 21 22 |
# File 'lib/shift/interface_list.rb', line 20 def hash @interfaces.hash end |
#inspect ⇒ Object
24 25 26 |
# File 'lib/shift/interface_list.rb', line 24 def inspect 'InterfaceList' + @interfaces.inspect end |
#pick ⇒ Class
Pick the preferred available interface.
35 36 37 38 39 |
# File 'lib/shift/interface_list.rb', line 35 def pick each_class {|kls| return kls if kls.available? } raise DependencyError, "nothing available: " + help_string end |
#to_hash ⇒ Object
11 12 13 |
# File 'lib/shift/interface_list.rb', line 11 def to_hash @interfaces.dup end |