Class: Pio::Actions

Inherits:
BinData::Primitive
  • Object
show all
Defined in:
lib/pio/open_flow13/actions.rb

Overview

Actions list of actions-apply instruction.

Instance Method Summary collapse

Instance Method Details

#getObject

rubocop:disable MethodLength



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/pio/open_flow13/actions.rb', line 25

def get
  actions = []
  tmp = binary
  while tmp.length > 0
    action = case BinData::Uint16be.read(tmp)
             when 0
               SendOutPort.read(tmp)
             else
               UnsupportedAction.read(tmp)
             end
    tmp = tmp[action.length..-1]
    actions << action
  end
  actions
end

#set(actions) ⇒ Object



20
21
22
# File 'lib/pio/open_flow13/actions.rb', line 20

def set(actions)
  self.binary = Array(actions).map(&:to_binary).join
end