Class: Pio::OpenFlow10::Match
- Inherits:
-
Pio::OpenFlow::FlowMatch
- Object
- Pio::OpenFlow::FlowMatch
- Pio::OpenFlow10::Match
- Defined in:
- lib/pio/open_flow10/match.rb
Overview
Fields to match against flows
Defined Under Namespace
Classes: MatchFormat, MatchIpAddress, Wildcards
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(user_options = {}) ⇒ Match
constructor
rubocop:disable MethodLength This method smells of :reek:FeatureEnvy This method smells of :reek:DuplicateMethodCall.
- #method_missing(method, *args, &block) ⇒ Object
-
#to_binary ⇒ Object
rubocop:enable MethodLength.
Constructor Details
#initialize(user_options = {}) ⇒ Match
rubocop:disable MethodLength This method smells of :reek:FeatureEnvy This method smells of :reek:DuplicateMethodCall
138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/pio/open_flow10/match.rb', line 138 def initialize( = {}) flags = Wildcards::FLAGS.each_with_object({}) do |each, memo| memo[each] = true unless .key?(each) end Wildcards::NW_FLAGS.each_with_object(flags) do |each, memo| if .key?(each) memo[each] = 32 - IPv4Address.new([each]).prefixlen else memo["#{each}_all".to_sym] = true end end @format = MatchFormat.new({ wildcards: flags }.merge()) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
162 163 164 |
# File 'lib/pio/open_flow10/match.rb', line 162 def method_missing(method, *args, &block) @format.__send__ method, *args, &block end |
Class Method Details
.read(binary) ⇒ Object
131 132 133 |
# File 'lib/pio/open_flow10/match.rb', line 131 def self.read(binary) MatchFormat.read binary end |
Instance Method Details
#==(other) ⇒ Object
157 158 159 160 |
# File 'lib/pio/open_flow10/match.rb', line 157 def ==(other) return false unless other to_binary == other.to_binary end |
#to_binary ⇒ Object
rubocop:enable MethodLength
153 154 155 |
# File 'lib/pio/open_flow10/match.rb', line 153 def to_binary @format.to_binary_s end |