class Spior::Network

Attributes

card[RW]

Public Class Methods

new(name = false) click to toggle source
# File lib/spior/network.rb, line 7
def initialize(name = false)
  @name = name
  @check = false
end

Private Instance Methods

ask_for_card() click to toggle source
# File lib/spior/network.rb, line 34
def ask_for_card
  until @check == true
    Interfacez.all do |interface|
      print interface + " "
    end
    printf "\nWhat is the name of the card to be used? "
    @name = gets.chomp
    verify_card
  end
end
verify_card() click to toggle source
# File lib/spior/network.rb, line 22
def verify_card
  return if @check or not @name
  Interfacez.all do |interface|
    if interface == @name then
      @check = true
    end
  end
  if not @check then
    Msg.err "Your interface #{@name} is no found"
  end
end