Class: Rex::Poly::Machine::Block
- Inherits:
-
Object
- Object
- Rex::Poly::Machine::Block
- Defined in:
- lib/rex/poly/machine/machine.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
attr_accessor :next, :previous.
Instance Method Summary collapse
- #<<(permutation) ⇒ Object
- #each ⇒ Object
-
#initialize(name) ⇒ Block
constructor
A new instance of Block.
- #shuffle ⇒ Object
- #solve ⇒ Object
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
#name ⇒ Object (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 |
#each ⇒ Object
250 251 252 253 254 |
# File 'lib/rex/poly/machine/machine.rb', line 250 def each @permutations.each do | permutation | yield permutation end end |
#shuffle ⇒ Object
238 239 240 |
# File 'lib/rex/poly/machine/machine.rb', line 238 def shuffle @permutations = @permutations.shuffle end |
#solve ⇒ Object
242 243 244 |
# File 'lib/rex/poly/machine/machine.rb', line 242 def solve @permutations.first.solve end |