Class: Rex::Poly::Machine::Block

Inherits:
Object
  • Object
show all
Defined in:
lib/rex/poly/machine/machine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Block

Returns a new instance of Block.



231
232
233
234
235
236
# File 'lib/rex/poly/machine/machine.rb', line 231

def initialize( name )
  @name         = name
  @next         = nil
  @previous     = nil
  @permutations = ::Array.new
end

Instance Attribute Details

#nameObject (readonly)

attr_accessor :next, :previous



229
230
231
# File 'lib/rex/poly/machine/machine.rb', line 229

def name
  @name
end

Instance Method Details

#<<(permutation) ⇒ Object



246
247
248
# File 'lib/rex/poly/machine/machine.rb', line 246

def << ( permutation )
  @permutations << permutation
end

#eachObject



250
251
252
253
254
# File 'lib/rex/poly/machine/machine.rb', line 250

def each
  @permutations.each do | permutation |
    yield permutation
  end
end

#shuffleObject



238
239
240
# File 'lib/rex/poly/machine/machine.rb', line 238

def shuffle
  @permutations = @permutations.shuffle
end

#solveObject



242
243
244
# File 'lib/rex/poly/machine/machine.rb', line 242

def solve
  @permutations.first.solve
end