Class: ArtDecomp::Arch
- Inherits:
-
Object
- Object
- ArtDecomp::Arch
- Defined in:
- lib/art-decomp/arch.rb
Instance Attribute Summary collapse
-
#pins ⇒ Object
readonly
Returns the value of attribute pins.
-
#pons ⇒ Object
readonly
Returns the value of attribute pons.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #cells(archs) ⇒ Object
- #hash ⇒ Object
-
#initialize(pins, pons) ⇒ Arch
constructor
A new instance of Arch.
- #to_s ⇒ Object
Constructor Details
#initialize(pins, pons) ⇒ Arch
Returns a new instance of Arch.
9 10 11 |
# File 'lib/art-decomp/arch.rb', line 9 def initialize pins, pons @pins, @pons = pins, pons end |
Instance Attribute Details
#pins ⇒ Object (readonly)
Returns the value of attribute pins.
3 4 5 |
# File 'lib/art-decomp/arch.rb', line 3 def pins @pins end |
#pons ⇒ Object (readonly)
Returns the value of attribute pons.
3 4 5 |
# File 'lib/art-decomp/arch.rb', line 3 def pons @pons end |
Class Method Details
.[](pins, pons) ⇒ Object
5 6 7 |
# File 'lib/art-decomp/arch.rb', line 5 def self.[] pins, pons new pins, pons end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
13 14 15 |
# File 'lib/art-decomp/arch.rb', line 13 def == other [@pins, @pons] == [other.pins, other.pons] end |
#cells(archs) ⇒ Object
17 18 19 20 |
# File 'lib/art-decomp/arch.rb', line 17 def cells archs pons = archs.select { |a| a.pins >= @pins }.map(&:pons).max (@pons % pons).zero? ? @pons / pons : @pons / pons + 1 rescue nil end |
#hash ⇒ Object
24 25 26 |
# File 'lib/art-decomp/arch.rb', line 24 def hash @pins.hash ^ @pons.hash end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/art-decomp/arch.rb', line 28 def to_s "#{pins}/#{pons}" end |