Class: SpecTools::Landscape
- Inherits:
-
Object
- Object
- SpecTools::Landscape
- Extended by:
- SpecToolsExtensions
- Includes:
- SpecToolsExtensions
- Defined in:
- lib/spectools.rb,
lib/vnmsh.rb
Overview
SpecTools::Landscape
Represents a Spectrum Landscape
Instance Attribute Summary collapse
-
#handle ⇒ Object
The landscape’s handle.
-
#port ⇒ Object
The SS port that the landscape is using.
-
#precedence ⇒ Object
The landscape’s precedence.
-
#service ⇒ Object
The landscape’s service.
-
#ss ⇒ Object
This landscape’s SpectroSERVER.
Class Method Summary collapse
-
.cli_get_landscapes(session = nil) ⇒ Object
Use CLI to retrieve all available landscapes.
-
.cli_parse(line) ⇒ Object
Take a line of CLI
show landscapesoutput and populate a new Landscape object.
Instance Method Summary collapse
-
#initialize(handle = nil, ssname = nil, precedence = nil, port = nil, service = nil) ⇒ Landscape
constructor
A new instance of Landscape.
Methods included from SpecToolsExtensions
call_default_extension, call_extension, method_missing, method_missing
Constructor Details
#initialize(handle = nil, ssname = nil, precedence = nil, port = nil, service = nil) ⇒ Landscape
Returns a new instance of Landscape.
515 516 517 518 519 520 521 522 523 524 525 |
# File 'lib/spectools.rb', line 515 def initialize(handle = nil, ssname = nil, precedence = nil, port = nil, service = nil) @ss = ssname @precedence = precedence @port = port @service = service if handle.nil? || handle.hex? @handle = handle else raise ArgumentError, "Handle is not a hex code" end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class SpecToolsExtensions
Instance Attribute Details
#handle ⇒ Object
The landscape’s handle
513 514 515 |
# File 'lib/spectools.rb', line 513 def handle @handle end |
#port ⇒ Object
The SS port that the landscape is using
509 510 511 |
# File 'lib/spectools.rb', line 509 def port @port end |
#precedence ⇒ Object
The landscape’s precedence
507 508 509 |
# File 'lib/spectools.rb', line 507 def precedence @precedence end |
#service ⇒ Object
The landscape’s service
511 512 513 |
# File 'lib/spectools.rb', line 511 def service @service end |
#ss ⇒ Object
This landscape’s SpectroSERVER
505 506 507 |
# File 'lib/spectools.rb', line 505 def ss @ss end |
Class Method Details
.cli_get_landscapes(session = nil) ⇒ Object
Use CLI to retrieve all available landscapes.
862 863 864 865 866 867 868 869 870 |
# File 'lib/vnmsh.rb', line 862 def self.cli_get_landscapes(session=nil) session = VNMSH.get_session(session) landscapes = Array.new lscape_output = session.show_landscapes lscape_output.each do |line| landscapes.push(Landscape.parse(line)) end return landscapes end |
.cli_parse(line) ⇒ Object
Take a line of CLI show landscapes output and populate a new Landscape object.
855 856 857 858 859 |
# File 'lib/vnmsh.rb', line 855 def self.cli_parse(line) ssname,precedence,port,service,handle = line.chomp.unpack('A33A14A8A12A10') landscape = Landscape.new(handle,ssname,precedence,port,service ) return landscape end |