Class: DevopsToolkit::Tasks::CIDR

Inherits:
Thor
  • Object
show all
Defined in:
lib/devops_toolkit/tasks/cidr.rb

Constant Summary collapse

DESC =
'CIDR related tasks'
COMMAND =
'cidr'

Instance Method Summary collapse

Instance Method Details

#size(cidr_block) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/devops_toolkit/tasks/cidr.rb', line 13

def size(cidr_block)
  begin
    cidr = NetAddr::CIDR.create(cidr_block)
    puts "Block #{cidr_block} has #{cidr.size} addresses in network"
  rescue Exception => e
    puts "#{e.class}: #{e.message}"
  end
end