Class: ArcWeld::Zone

Inherits:
Object
  • Object
show all
Includes:
Relationship, Resource
Defined in:
lib/arc_weld/resources/zone.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Relationship

included, #relationship_hash, #relationship_types

Methods included from Resource

#identity, #identity_hash, included, #parent_ref, #parent_ref=, #parent_uri=, #property_hash, #ref, #ref_uri, #relationship_hash, #render, #resource_class_id, #resource_type, #to_h

Instance Attribute Details

#cidrObject

Returns the value of attribute cidr.



13
14
15
# File 'lib/arc_weld/resources/zone.rb', line 13

def cidr
  @cidr
end

Instance Method Details

#contains?(addr) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/arc_weld/resources/zone.rb', line 38

def contains?(addr)
  comp = case addr
    when String
      IPAddr.new(addr)
    when IPAddr
      addr
    else
      nil
  end
  if ([comp, startAddress, endAddress].any? &:nil?)
    false
  else
    start_ip <= comp && end_ip >= comp
  end
end

#end_ipObject



34
35
36
# File 'lib/arc_weld/resources/zone.rb', line 34

def end_ip
  IPAddr.new(endAddress)
end

#start_ipObject



30
31
32
# File 'lib/arc_weld/resources/zone.rb', line 30

def start_ip
  IPAddr.new(startAddress)
end

#staticAddressingObject



54
55
56
57
58
59
60
61
62
63
# File 'lib/arc_weld/resources/zone.rb', line 54

def staticAddressing
  case self.dynamicAddressing
    when 'true', true
      'false'
    when 'false', false
      'true'
    else
      nil
  end
end