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.
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
#name ⇒ Object (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 |
#each ⇒ Object
249 250 251 252 253 |
# File 'lib/rex/poly/machine/machine.rb', line 249 def each @permutations.each do | permutation | yield permutation end end |
#shuffle ⇒ Object
237 238 239 |
# File 'lib/rex/poly/machine/machine.rb', line 237 def shuffle @permutations = @permutations.shuffle end |
#solve ⇒ Object
241 242 243 |
# File 'lib/rex/poly/machine/machine.rb', line 241 def solve @permutations.first.solve end |