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.



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

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

Instance Attribute Details

#nameObject (readonly)

attr_accessor :next, :previous



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

def name
  @name
end

Instance Method Details

#<<(permutation) ⇒ Object



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

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

#eachObject



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

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

#shuffleObject



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

def shuffle
  @permutations = @permutations.shuffle
end

#solveObject



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

def solve
  @permutations.first.solve
end