Module: HandInformation

Included in:
Hand
Defined in:
tomes/components/deck_builder/hand_information.rb

Overview

Provides some methods for obtaining information about a hand.

Instance Method Summary collapse

Instance Method Details

#empty?Boolean

Checks if #cards is empty.

Returns:

  • (Boolean)


13
14
15
# File 'tomes/components/deck_builder/hand_information.rb', line 13

def empty?
  cards.empty?
end

#full?(threshold = 1) ⇒ Boolean

Checks if the number of cards meets or exceeds a given threshold.

Parameters:

  • threshold (Integer) (defaults to: 1)

    Optional; defaults to 1.

Returns:

  • (Boolean)


27
28
29
# File 'tomes/components/deck_builder/hand_information.rb', line 27

def full?(threshold = 1)
  length >= threshold
end

#include?(this) ⇒ Boolean

Checks if #cards includes the provided Card.

Parameters:

Returns:

  • (Boolean)


20
21
22
# File 'tomes/components/deck_builder/hand_information.rb', line 20

def include?(this)
  cards.include?(this)
end

#lengthInteger

Returns the length of #cards.

Returns:

  • (Integer)


7
8
9
# File 'tomes/components/deck_builder/hand_information.rb', line 7

def length
  cards.length
end