class Rex::Poly::Permutation
This class encapsulates a LogicalBlock
permutation. Block permutations can take the form of a static string or a procedure. This makes it possible to have simple blocks and more complicated ones that take into account other variables, such as dynamic registers. The to_s
method will return the string version of the permutation, regardless of whether or not the underlying permutation is a string or a procedure.
Attributes
perm[R]
Public Class Methods
new(perm, block)
click to toggle source
Initializes the permutation and its associated block.
# File lib/rex/poly/block.rb, line 19 def initialize(perm, block) @perm = perm @block = block end
Public Instance Methods
length()
click to toggle source
Returns the length of the string returned by to_s.
# File lib/rex/poly/block.rb, line 27 def length to_s.length end
to_s()
click to toggle source
Returns the string representation of the permutation. If the underlying permutation is a procedure, the procedure is called. Otherwise, the string representation of the permutation is returned.
# File lib/rex/poly/block.rb, line 36 def to_s if (@perm.kind_of?(Proc)) @perm.call(@block).to_s else @perm.to_s end end