class Pio::OpenFlow10::Match

Fields to match against flows

Public Class Methods

new(user_options = {}) click to toggle source

rubocop:disable MethodLength This method smells of :reek:FeatureEnvy This method smells of :reek:DuplicateMethodCall

# File lib/pio/open_flow10/match.rb, line 138
def initialize(user_options = {})
  flags = Wildcards::FLAGS.each_with_object({}) do |each, memo|
    memo[each] = true unless user_options.key?(each)
  end
  Wildcards::NW_FLAGS.each_with_object(flags) do |each, memo|
    if user_options.key?(each)
      memo[each] = 32 - IPv4Address.new(user_options[each]).prefixlen
    else
      memo["#{each}_all".to_sym] = true
    end
  end
  @format = MatchFormat.new({ wildcards: flags }.merge(user_options))
end
read(binary) click to toggle source
# File lib/pio/open_flow10/match.rb, line 131
def self.read(binary)
  MatchFormat.read binary
end

Public Instance Methods

==(other) click to toggle source
# File lib/pio/open_flow10/match.rb, line 157
def ==(other)
  return false unless other
  to_binary == other.to_binary
end
method_missing(method, *args, &block) click to toggle source
# File lib/pio/open_flow10/match.rb, line 162
def method_missing(method, *args, &block)
  @format.__send__ method, *args, &block
end
to_binary() click to toggle source

rubocop:enable MethodLength

# File lib/pio/open_flow10/match.rb, line 153
def to_binary
  @format.to_binary_s
end