Class: GamesAndRpgParadise::Solitaire::Card

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

Overview

GamesAndRpgParadise::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 included from Base::Extensions::Colours

Base::Extensions::Colours::ARRAY_AVAILABLE_KONSOLE_COLOURS

Constants included from CommonExtensions

CommonExtensions::CONTROL_C_CODE, CommonExtensions::N

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base::Extensions::Colours

ecomment, #efancy, #eparse, #forestgreen, #gold, #grey, #lightblue, #mediumseagreen, #mediumslateblue, #peru, #rev, sdir, sfancy, #sfile, simp, #teal, #yellow

Methods included from Base::Extensions::CommandlineArguments

#commandline_arguments?, #filter_away_commandline_arguments, #first_argument?, #first_non_hyphened_argument?, #set_commandline_arguments

Methods included from CommonExtensions

#cat, #cd, #cliner, #copy_file, #delete, #dirname_but_retains_the_trailing_slash, #disable_colours, #ensure_that_the_log_directory_exists, #esystem, #get_user_input, #infer_the_namespace, #is_on_roebe?, #log_dir?, #mkdir, #mkdir_then_cd_into_it, #mv, #namespace?, #opne, #opnn, #project_base_directory?, #project_image_directory?, #project_yaml_directory?, #rds, #register_sigint, #remove_this_directory, #rename_file, #reset_the_internal_hash, #return_pwd, #return_today, #touch_file, #wrap, #write_what_into

Constructor Details

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

#

initialize

#


48
49
50
51
52
53
54
55
56
57
# File 'lib/games_and_rpg_paradise/games/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 = ARGV) ⇒ Object

#

GamesAndRpgParadise::Solitaire::Card[]

#


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

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

Instance Method Details

#rank?Boolean

#

rank?

    1. ace

#

Returns:

  • (Boolean)


85
86
87
# File 'lib/games_and_rpg_paradise/games/solitaire/card.rb', line 85

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

#represents?Boolean

#

represents?

#

Returns:

  • (Boolean)


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

def represents?
  @represents_what
end

#resetObject

#

reset (reset tag)

#


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

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

#runObject

#

run (run tag)

#


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

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

#suit?Boolean

#

suit?

    1. the club. This depends on @represents_what.

#

Returns:

  • (Boolean)


76
77
78
# File 'lib/games_and_rpg_paradise/games/solitaire/card.rb', line 76

def suit?
  @represents_what[0,1]
end

#to_sObject

#

to_s

#


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

def to_s
  @represents_what.to_s
end