Class: Tundengine::Ranks::Base

Inherits:
Object
  • Object
show all
Includes:
Comparable, Singleton, StringifiableByClass
Defined in:
lib/tundengine/ranks/base.rb

Direct Known Subclasses

Cinco, Cuatro, Diez, Doce, Dos, Null, Once, Seis, Siete, Tres, Uno

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from StringifiableByClass

#to_s

Constructor Details

#initializeBase

Returns a new instance of Base.



24
25
26
27
# File 'lib/tundengine/ranks/base.rb', line 24

def initialize
  @round_points = self.class::ROUND_POINTS
  @power        = self.class::POWER
end

Instance Attribute Details

#powerObject (readonly)

Returns the value of attribute power.



9
10
11
# File 'lib/tundengine/ranks/base.rb', line 9

def power
  @power
end

#round_pointsObject (readonly)

Returns the value of attribute round_points.



9
10
11
# File 'lib/tundengine/ranks/base.rb', line 9

def round_points
  @round_points
end

Class Method Details

.de(suit) ⇒ Object



11
12
13
# File 'lib/tundengine/ranks/base.rb', line 11

def self.de(suit)
  instance.de(suit)
end

Instance Method Details

#<=>(other_rank) ⇒ Object



20
21
22
# File 'lib/tundengine/ranks/base.rb', line 20

def <=>(other_rank)
  @power <=> other_rank.power
end

#de(suit) ⇒ Object



15
16
17
18
# File 'lib/tundengine/ranks/base.rb', line 15

def de(suit)
  s = suit.is_a?(Suits::Base) ? suit : suit.instance
  Cards::Card.new(self, s)
end