class Proxy::DHCP::Infoblox::RangeRegularExpressionGenerator::MergedNode

Attributes

children[RW]
value[RW]

Public Class Methods

new(a_node) click to toggle source
# File lib/smart_proxy_dhcp_infoblox/network_address_range_regex_generator.rb, line 57
def initialize(a_node)
  @value = [a_node.value].flatten
  @children = a_node.children
end

Public Instance Methods

==(other) click to toggle source
# File lib/smart_proxy_dhcp_infoblox/network_address_range_regex_generator.rb, line 75
def ==(other)
  return false if self.class != other.class

  value == other.value
end
as_regex() click to toggle source
# File lib/smart_proxy_dhcp_infoblox/network_address_range_regex_generator.rb, line 67
def as_regex
  children.empty? ? [value_as_regex] : children.map { |c| c.as_regex.map { |r| value_as_regex + r } }.flatten
end
merge(other) click to toggle source
# File lib/smart_proxy_dhcp_infoblox/network_address_range_regex_generator.rb, line 62
def merge(other)
  value.push(other.value).flatten!
  self
end
value_as_regex() click to toggle source
# File lib/smart_proxy_dhcp_infoblox/network_address_range_regex_generator.rb, line 71
def value_as_regex
  (value.size < 2) ? value.first.to_s : "[#{value.join}]"
end