Class: GamesParadise::Solitaire::Card

Inherits:
Base
  • Object
show all
Defined in:
lib/games_paradise/solitaire/card.rb

Overview

GamesParadise::Solitaire::Solitaire

Constant Summary collapse

ARRAY_AVAILABLE_RANKS =
#

ARRAY_AVAILABLE_RANKS

#
%w(
   Ace
   2
   3
   4
   5
   6
   7
   8
   9
  10
  Jack
  Queen
  King
)

Constants inherited from Base

Base::CONTROL_C_CODE, Base::N

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#cat, #commandline_arguments?, #efancy, #eparse, #first_argument?, #forestgreen, #gold, #lightblue, #lightgreen, #mediumorchid, #mediumslateblue, #opnn, #peru, #register_sigint, #rev, #royalblue, #set_commandline_arguments, #sfile, #steelblue, #teal, #tomato, #yellow

Methods included from BaseModule

#cliner, #commandline_arguments?, #first_argument?, #infer_the_namespace, #namespace?, #rename_file, #reset_the_internal_hash, #return_pwd, #set_commandline_arguments

Constructor Details

#initialize(commandline_arguments = nil, run_already = true) ⇒ Card

#

initialize

#


48
49
50
51
52
53
54
55
56
57
# File 'lib/games_paradise/solitaire/card.rb', line 48

def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Class Method Details

.[](i = '') ⇒ Object

#

GamesParadise::Solitaire::Card[]

#


113
114
115
# File 'lib/games_paradise/solitaire/card.rb', line 113

def self.[](i = '')
  new(i)
end

Instance Method Details

#rank?Boolean

#

rank?

    1. ace

#

Returns:

  • (Boolean)


92
93
94
# File 'lib/games_paradise/solitaire/card.rb', line 92

def rank?
  @represents_what[1 .. -1]
end

#represents?Boolean

#

represents?

#

Returns:

  • (Boolean)


99
100
101
# File 'lib/games_paradise/solitaire/card.rb', line 99

def represents?
  @represents_what
end

#resetObject

#

reset (reset tag)

#


62
63
64
65
66
67
68
69
# File 'lib/games_paradise/solitaire/card.rb', line 62

def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === @represents_what
  # ======================================================================= #
  @represents_what = nil
end

#runObject

#

run (run tag)

#


74
75
76
# File 'lib/games_paradise/solitaire/card.rb', line 74

def run
  @represents_what = commandline_arguments?.join(' ').strip
end

#suit?Boolean

#

suit?

    1. the club. This depends on @represents_what.

#

Returns:

  • (Boolean)


83
84
85
# File 'lib/games_paradise/solitaire/card.rb', line 83

def suit?
  @represents_what[0,1]
end

#to_sObject

#

to_s

#


106
107
108
# File 'lib/games_paradise/solitaire/card.rb', line 106

def to_s
  @represents_what.to_s
end