class PacketGen::Header::Base::Bindings
@api private Class to handle header associations
Attributes
bindings[RW]
@return [Array<Binding>]
Public Class Methods
new()
click to toggle source
# File lib/packetgen/header/base.rb, line 86 def initialize @bindings = [] end
Public Instance Methods
<<(arg)
click to toggle source
@param [Object] arg @return [Bindings] self
# File lib/packetgen/header/base.rb, line 96 def <<(arg) @bindings.last << arg end
check?(fields)
click to toggle source
Check fields
responds to set of bindings @param [Types::Fields] fields @return [Boolean]
# File lib/packetgen/header/base.rb, line 124 def check?(fields) @bindings.any? { |group| group.all? { |binding| binding.check?(fields) } } end
each(&block)
click to toggle source
each iterator @return [void]
# File lib/packetgen/header/base.rb, line 102 def each(&block) @bindings.each(&block) end
empty?()
click to toggle source
@return [Boolean]
# File lib/packetgen/header/base.rb, line 107 def empty? @bindings.empty? end
new_set()
click to toggle source
# File lib/packetgen/header/base.rb, line 90 def new_set @bindings << [] end
set(fields)
click to toggle source
Set fields
to bindings value @param [Types::Fields] fields @return [void]
# File lib/packetgen/header/base.rb, line 131 def set(fields) @bindings.first.each { |b| b.set fields } end
to_h()
click to toggle source
Return binding as a hash. @return [Hash]
# File lib/packetgen/header/base.rb, line 113 def to_h hsh = {} each do |b| b.each { |sb| hsh[sb.key] = sb.value } end hsh end