Class: VCloudSdk::IpRanges

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_vcloud_sdk/ip_ranges.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value = nil) ⇒ IpRanges

Returns a new instance of IpRanges.



8
9
10
11
12
# File 'lib/ruby_vcloud_sdk/ip_ranges.rb', line 8

def initialize(value = nil)
  @ranges = Set.new

  parse_ip_ranges(value) unless value.nil?
end

Instance Attribute Details

#rangesObject

Returns the value of attribute ranges.



6
7
8
# File 'lib/ruby_vcloud_sdk/ip_ranges.rb', line 6

def ranges
  @ranges
end

Instance Method Details

#add(ip_ranges) ⇒ Object Also known as: +



14
15
16
17
18
19
20
# File 'lib/ruby_vcloud_sdk/ip_ranges.rb', line 14

def add(ip_ranges)
  ip_ranges = objectify ip_ranges
  result = IpRanges.new
  result.ranges.merge @ranges
  result.ranges.merge ip_ranges.ranges
  result
end

#include?(ip_ranges) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
36
# File 'lib/ruby_vcloud_sdk/ip_ranges.rb', line 33

def include?(ip_ranges)
  ip_ranges = objectify ip_ranges
  @ranges.superset? ip_ranges.ranges
end

#subtract(ip_ranges) ⇒ Object Also known as: -



23
24
25
26
27
28
29
30
# File 'lib/ruby_vcloud_sdk/ip_ranges.rb', line 23

def subtract(ip_ranges)
  ip_ranges = objectify ip_ranges
  difference = IpRanges.new
  difference.ranges.merge @ranges
  difference.ranges.subtract ip_ranges.ranges

  difference
end