class Courgette::Device

Attributes

ip[R]
vendor[R]

Public Class Methods

new(details) click to toggle source
# File lib/courgette/device.rb, line 5
def initialize(details)
  @ip = details['ip']
  @vendor = details['vendor']
  @details = details
end

Public Instance Methods

fetch(debug = false) click to toggle source
# File lib/courgette/device.rb, line 11
def fetch(debug = false)
  chain = Chain.all.find { |chain| chain.responsible_of(@vendor) }
  chain ? chain.apply(@ip, @details) : raise("Vendor not found")
end
to_s() click to toggle source
# File lib/courgette/device.rb, line 16
def to_s
  "#{ip}/#{vendor}"
end