Class: PacketGen::Header::Base::ProcBinding Private

Inherits:
Object
  • Object
show all
Defined in:
lib/packetgen/header/base.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class to handle a header association from procs

Instance Method Summary collapse

Constructor Details

#initialize(procs) ⇒ ProcBinding

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ProcBinding.

Parameters:

  • procs (Array<Proc>)

    first proc is used to set fields, second proc is used to check binding



58
59
60
61
# File 'lib/packetgen/header/base.rb', line 58

def initialize(procs)
  @set = procs.shift
  @check = procs.shift
end

Instance Method Details

#check?(fields) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Check fields responds to binding

Parameters:

Returns:

  • (Boolean)


66
67
68
# File 'lib/packetgen/header/base.rb', line 66

def check?(fields)
  @check.call(fields)
end

#set(fields) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Set fields field to binding value

Parameters:



73
74
75
# File 'lib/packetgen/header/base.rb', line 73

def set(fields)
  @set.call(fields)
end