Module: AsciiParadise

Defined in:
lib/ascii_paradise/base/menu.rb,
lib/ascii_paradise/base/base.rb,
lib/ascii_paradise/demo/demo.rb,
lib/ascii_paradise/base/debug.rb,
lib/ascii_paradise/base/reset.rb,
lib/ascii_paradise/sparky/cli.rb,
lib/ascii_paradise/debug/debug.rb,
lib/ascii_paradise/table/table.rb,
lib/ascii_paradise/base/colours.rb,
lib/ascii_paradise/misc/lobster.rb,
lib/ascii_paradise/ascii_say/say.rb,
lib/ascii_paradise/asciitable/row.rb,
lib/ascii_paradise/constants/misc.rb,
lib/ascii_paradise/animation/reset.rb,
lib/ascii_paradise/animations/bird.rb,
lib/ascii_paradise/animations/fire.rb,
lib/ascii_paradise/animations/moth.rb,
lib/ascii_paradise/animations/whip.rb,
lib/ascii_paradise/animations/worm.rb,
lib/ascii_paradise/asciitable/cell.rb,
lib/ascii_paradise/base/initialize.rb,
lib/ascii_paradise/colours/colours.rb,
lib/ascii_paradise/flexbox/flexbox.rb,
lib/ascii_paradise/project/project.rb,
lib/ascii_paradise/version/version.rb,
lib/ascii_paradise/animations/diver.rb,
lib/ascii_paradise/animations/earth.rb,
lib/ascii_paradise/animations/genie.rb,
lib/ascii_paradise/animations/jello.rb,
lib/ascii_paradise/animations/phone.rb,
lib/ascii_paradise/asciitable/style.rb,
lib/ascii_paradise/asciitable/table.rb,
lib/ascii_paradise/commandline/help.rb,
lib/ascii_paradise/commandline/menu.rb,
lib/ascii_paradise/sparky/constants.rb,
lib/ascii_paradise/sparky/sparkline.rb,
lib/ascii_paradise/static_ascii/box.rb,
lib/ascii_paradise/animation/display.rb,
lib/ascii_paradise/animations/airbus.rb,
lib/ascii_paradise/animations/seesaw.rb,
lib/ascii_paradise/animations/spider.rb,
lib/ascii_paradise/animations/tetris.rb,
lib/ascii_paradise/animations/turtle.rb,
lib/ascii_paradise/animations/worker.rb,
lib/ascii_paradise/curses/table_flip.rb,
lib/ascii_paradise/animations/bunnies.rb,
lib/ascii_paradise/animations/chopper.rb,
lib/ascii_paradise/animations/counter.rb,
lib/ascii_paradise/animations/raining.rb,
lib/ascii_paradise/animations/shotgun.rb,
lib/ascii_paradise/animations/steamer.rb,
lib/ascii_paradise/animations/volcano.rb,
lib/ascii_paradise/static_ascii/heart.rb,
lib/ascii_paradise/toplevel_methods/e.rb,
lib/ascii_paradise/animation/animation.rb,
lib/ascii_paradise/animations/anti_air.rb,
lib/ascii_paradise/animations/aquarium.rb,
lib/ascii_paradise/animations/backflip.rb,
lib/ascii_paradise/animations/bunnycat.rb,
lib/ascii_paradise/animations/gargoyle.rb,
lib/ascii_paradise/animations/hadouken.rb,
lib/ascii_paradise/animations/juggling.rb,
lib/ascii_paradise/animations/macarena.rb,
lib/ascii_paradise/animations/raindrop.rb,
lib/ascii_paradise/static_ascii/circle.rb,
lib/ascii_paradise/static_ascii/ponies.rb,
lib/ascii_paradise/animations/boomerang.rb,
lib/ascii_paradise/animations/cigarette.rb,
lib/ascii_paradise/animations/coin_roll.rb,
lib/ascii_paradise/animations/fireworks.rb,
lib/ascii_paradise/animations/hourglass.rb,
lib/ascii_paradise/animations/jump_rope.rb,
lib/ascii_paradise/animations/pull_rope.rb,
lib/ascii_paradise/animations/star_trek.rb,
lib/ascii_paradise/asciitable/separator.rb,
lib/ascii_paradise/toplevel_methods/new.rb,
lib/ascii_paradise/animations/basketball.rb,
lib/ascii_paradise/animations/reflection.rb,
lib/ascii_paradise/animations/sand_clock.rb,
lib/ascii_paradise/animations/trampoline.rb,
lib/ascii_paradise/static_ascii/cat_face.rb,
lib/ascii_paradise/toplevel_methods/misc.rb,
lib/ascii_paradise/unicode/double_border.rb,
lib/ascii_paradise/animations/baby_dragon.rb,
lib/ascii_paradise/animations/bird_attack.rb,
lib/ascii_paradise/animations/bouncy_ball.rb,
lib/ascii_paradise/animations/dot_factory.rb,
lib/ascii_paradise/animations/driving_car.rb,
lib/ascii_paradise/animations/flying_head.rb,
lib/ascii_paradise/animations/hand_of_god.rb,
lib/ascii_paradise/animations/intercourse.rb,
lib/ascii_paradise/animations/jumping_pig.rb,
lib/ascii_paradise/animations/laser_clock.rb,
lib/ascii_paradise/animations/rubber_duck.rb,
lib/ascii_paradise/animations/running_man.rb,
lib/ascii_paradise/animations/silent_city.rb,
lib/ascii_paradise/animations/wrist_watch.rb,
lib/ascii_paradise/static_ascii/mona_lisa.rb,
lib/ascii_paradise/animations/ball_factory.rb,
lib/ascii_paradise/animations/dancing_girl.rb,
lib/ascii_paradise/animations/eye_wiggling.rb,
lib/ascii_paradise/animations/good_morning.rb,
lib/ascii_paradise/animations/loading_dots.rb,
lib/ascii_paradise/animations/progress_bar.rb,
lib/ascii_paradise/animations/rotating_dna.rb,
lib/ascii_paradise/animations/sailing_boat.rb,
lib/ascii_paradise/animations/soccer_twins.rb,
lib/ascii_paradise/animations/table_tennis.rb,
lib/ascii_paradise/animations/tears_of_ice.rb,
lib/ascii_paradise/asciitable/table_helper.rb,
lib/ascii_paradise/interactive/interactive.rb,
lib/ascii_paradise/toplevel_methods/figlet.rb,
lib/ascii_paradise/animations/animated_duck.rb,
lib/ascii_paradise/animations/block_breaker.rb,
lib/ascii_paradise/animations/body_builders.rb,
lib/ascii_paradise/animations/bouncing_ball.rb,
lib/ascii_paradise/animations/bubble_dragon.rb,
lib/ascii_paradise/animations/canadian_flag.rb,
lib/ascii_paradise/animations/digital_clock.rb,
lib/ascii_paradise/animations/flame_thrower.rb,
lib/ascii_paradise/animations/human_factory.rb,
lib/ascii_paradise/animations/one_destroyer.rb,
lib/ascii_paradise/animations/riding_a_duck.rb,
lib/ascii_paradise/animations/rotating_cube.rb,
lib/ascii_paradise/animations/swimming_lane.rb,
lib/ascii_paradise/toplevel_methods/wrap_at.rb,
lib/ascii_paradise/www/embeddable_interface.rb,
lib/ascii_paradise/animations/airplane_fight.rb,
lib/ascii_paradise/animations/animated_clock.rb,
lib/ascii_paradise/animations/breaking_glass.rb,
lib/ascii_paradise/animations/car_production.rb,
lib/ascii_paradise/animations/catch_the_ball.rb,
lib/ascii_paradise/animations/circle_of_life.rb,
lib/ascii_paradise/animations/endless_runner.rb,
lib/ascii_paradise/animations/firework_clock.rb,
lib/ascii_paradise/animations/lightning_bolt.rb,
lib/ascii_paradise/animations/parachute_jump.rb,
lib/ascii_paradise/animations/rotating_globe.rb,
lib/ascii_paradise/animations/rotating_slash.rb,
lib/ascii_paradise/animations/shooting_range.rb,
lib/ascii_paradise/animations/stepper_lepper.rb,
lib/ascii_paradise/constants/unicode_symbols.rb,
lib/ascii_paradise/static_ascii/pink_panther.rb,
lib/ascii_paradise/animations/animated_pacman.rb,
lib/ascii_paradise/animations/basketball_game.rb,
lib/ascii_paradise/animations/biker_and_snail.rb,
lib/ascii_paradise/animations/exploding_alien.rb,
lib/ascii_paradise/animations/friendly_monkey.rb,
lib/ascii_paradise/animations/station_traffic.rb,
lib/ascii_paradise/animations/thread_and_ball.rb,
lib/ascii_paradise/static_ascii/static_pacman.rb,
lib/ascii_paradise/asciitable/toplevel_methods.rb,
lib/ascii_paradise/clock_counter/clock_counter.rb,
lib/ascii_paradise/static_ascii/seductive_lady.rb,
lib/ascii_paradise/toplevel_methods/sort_files.rb,
lib/ascii_paradise/animations/exploding_bubbles.rb,
lib/ascii_paradise/animations/firework_launcher.rb,
lib/ascii_paradise/animations/framerate_walking.rb,
lib/ascii_paradise/animations/planting_a_forest.rb,
lib/ascii_paradise/ascii_say/parse_static_ascii.rb,
lib/ascii_paradise/static_ascii/attractive_lady.rb,
lib/ascii_paradise/toplevel_methods/clear_screen.rb,
lib/ascii_paradise/toplevel_methods/to_camelcase.rb,
lib/ascii_paradise/animations/endless_monkey_bars.rb,
lib/ascii_paradise/static_ascii/beautiful_pattern.rb,
lib/ascii_paradise/static_ascii/colourful_flowers.rb,
lib/ascii_paradise/animations/airplane_over_forest.rb,
lib/ascii_paradise/animations/animated_progress_bar.rb,
lib/ascii_paradise/animations/bouncy_exploding_ball.rb,
lib/ascii_paradise/animations/neverending_staircase.rb,
lib/ascii_paradise/static_ascii/sierpinksi_triangle.rb,
lib/ascii_paradise/toplevel_methods/register_sigint.rb,
lib/ascii_paradise/requires/require_animations_files.rb,
lib/ascii_paradise/requires/require_sparky_components.rb,
lib/ascii_paradise/requires/require_static_ascii_files.rb,
lib/ascii_paradise/animations/ball_bounces_against_wall.rb,
lib/ascii_paradise/animations/soccer_in_front_of_a_house.rb,
lib/ascii_paradise/requires/require_the_toplevel_methods.rb,
lib/ascii_paradise/animations/dog_tries_to_catch_the_ball.rb,
lib/ascii_paradise/toplevel_methods/n_animated_components.rb,
lib/ascii_paradise/toplevel_methods/colour_parse_this_string.rb,
lib/ascii_paradise/gui/universal_widgets/animated_frame/widget.rb,
lib/ascii_paradise/toplevel_methods/available_ascii_components.rb,
lib/ascii_paradise/toplevel_methods/run_this_animated_component.rb,
lib/ascii_paradise/toplevel_methods/show_available_ascii_components.rb,
lib/ascii_paradise/toplevel_methods/run_class_based_on_this_filename.rb,
lib/ascii_paradise/gui/universal_widgets/animated_frame/animated_frame.rb,
lib/ascii_paradise/toplevel_methods/available_ascii_components_options.rb,
lib/ascii_paradise/toplevel_methods/return_dataset_of_this_animated_ascii_component.rb

Overview

#

require ‘ascii_paradise/toplevel_methods/return_dataset_of_this_animated_ascii_component.rb’ dataset = AsciiParadise.dataset_for(:rubber_duck)

#

Defined Under Namespace

Modules: EmbeddableInterface, GUI, Heart, Unicode Classes: Airbus, AirplaneFight, AirplaneOverForest, AnimatedClock, AnimatedDuck, AnimatedPacman, AnimatedProgressBar, Animation, AntiAir, Aquarium, AsciiTable, AttractiveLady, BabyDragon, Backflip, BallBouncesAgainstWall, BallFactory, Base, Basketball, BasketballGame, BeautifulPattern, BikerAndSnail, Bird, BirdAttack, BlockBreaker, BodyBuilders, Boomerang, BouncingBall, BouncyBall, BouncyExplodingBall, Box, BreakingGlass, BubbleDragon, Bunnies, Bunnycat, CanadianFlag, CarProduction, CatFace, CatchTheBall, Chopper, Cigarette, Circle, CircleOfLife, ClockCounter, CoinRoll, ColourfulFlowers, Counter, DancingGirl, DigitalClock, Diver, DogTriesToCatchTheBall, DotFactory, DrivingCar, Earth, EndlessMonkeyBars, EndlessRunner, ExplodingAlien, ExplodingBubbles, EyeWiggling, Fire, FireworkClock, FireworkLauncher, Fireworks, FlameThrower, Flexbox, FlyingHead, FramerateWalking, FriendlyMonkey, Gargoyle, Genie, GoodMorning, Hadouken, HandOfGod, Hourglass, HumanFactory, Intercourse, Jello, Juggling, JumpRope, JumpingPig, LaserClock, LightningBolt, LoadingDots, Lobster, Macarena, MonaLisa, Moth, NeverendingStaircase, OneDestroyer, ParachuteJump, ParseStaticAscii, Phone, PinkPanther, PlantingAForest, Ponies, ProgressBar, PullRope, Raindrop, Raining, Reflection, RidingADuck, RotatingCube, RotatingDNA, RotatingGlobe, RotatingSlash, RubberDuck, RunningMan, SailingBoat, SandClock, SeductiveLady, Seesaw, ShootingRange, Shotgun, SierpinksiTriangle, SilentCity, SoccerInFrontOfAHouse, SoccerTwins, Sparky, Spider, StarTrek, StaticPacman, StationTraffic, Steamer, StepperLepper, SwimmingLane, TableFlip, TableTennis, TearsOfIce, Tetris, ThreadAndBall, Trampoline, Turtle, Volcano, Whip, Worker, Worm, WristWatch

Constant Summary collapse

N =
#

N

#
"\n"
R =
#

R

#
"\r"
HOME_DIRECTORY_OF_THE_USER_X =
#

HOME_DIRECTORY_OF_THE_USER_X

#
'/home/x/'
SLEEP_FOR_N_SECONDS =
#

SLEEP_FOR_N_SECONDS

#
0.40
CLEAR_COMMAND =
#

CLEAR_COMMAND

#
"\033[2J"
DEFAULT_COLOUR_TO_USE =
#

DEFAULT_COLOUR_TO_USE

#
:mediumseagreen
ARRAY_SAY_CONSTANTS =
#

ARRAY_SAY_CONSTANTS

The names here correspond to .ascii files. For instance, there will be a file called “cat_in_the_hat.ascii”, in the subdirectory ascii_say/.

Sort this Array alphabetically.

#
%w(
  alien
  buddha
  cat_in_the_hat
  cowsay
  dome_tent
  flower_decoration
  knight
  sexy_angel
  ponysay
  wizard
)
REGISTERED_CLASS_METHODS =
#

AsciiParadise::REGISTERED_CLASS_METHODS

Register all class methods that can be used via .random here.

#
%w(
  animated_clock
  animated_pacman
  animated_progress_bar
  animated_duck
  ascii_circle
  ascii_counter
  ascii_box
  ascii_heart
  ascii_volcano
  attractive_lady
  beautiful_pattern
  bubble_dragon
  dancing_girl
  mona_lisa
  pony_generator
  pink_panther
  progress_bar
  rotating_slash
  rotating_dna
  seductive_lady
  sierpinski_triangle
  swimming_lane
  static_pacman
  table_flip
  ascii_earth
  ascii_steamer
  ascii_hourglass
  ascii_moth
  ascii_turtle
  ascii_station_traffic
  ascii_running_man
  ascii_genie
  ascii_spider
  ascii_bunnycat
  ascii_bunnies
  ascii_fireworks
  ascii_diver
  ascii_good_morning
  ascii_gargoyle
  ascii_endless_runner
  ascii_chopper
)
PROJECT_BASE_DIRECTORY =
#

AsciiParadise::PROJECT_BASE_DIRECTORY

#
File.absolute_path("#{__dir__}/..")+'/'
VERSION =
#

VERSION

#
'0.2.76'
LAST_UPDATE =
#

LAST_UPDATE

#
'05.04.2024'
URL_TO_THE_DOCUMENTATION =
#

URL_TO_THE_DOCUMENTATION

#
"https://www.rubydoc.info/gems/#{self.to_s.split(/(?=[A-Z])/).join('_').downcase}/#{VERSION}"
AsciiCounter =
Counter
CAT_FACE =
#

AsciiParadise::CAT_FACE

#
File.read("#{static_dir?}cat_face.ascii")
MONA_LISA =
#

AsciiParadise::MONA_LISA

#
File.read("#{static_dir?}mona_lisa.ascii")
N_CHARACTERS_PER_LINE =
#

AsciiParadise::N_CHARACTERS_PER_LINE

Default value to be used for word-wrap splitting.

#
76
CHECKMARK_SYMBOL =
#

CHECKMARK_SYMBOL

#
"\u2713"
SNOWMAN =
#

SNOWMAN

#
"\u2603"
UNICODE_DOUBLE_BORDER_HORIZONTAL =
#

UNICODE_DOUBLE_BORDER_HORIZONTAL

#
''
UNICODE_DOUBLE_BORDER_VERTICAL =
#

UNICODE_DOUBLE_BORDER_VERTICAL

#
''
UNICODE_DOUBLE_BORDER_TOP_LEFT =
#

UNICODE_DOUBLE_BORDER_TOP_LEFT

#
''
UNICODE_DOUBLE_BORDER_TOP_RIGHT =
#

UNICODE_DOUBLE_BORDER_TOP_RIGHT

#
''
UNICODE_DOUBLE_BORDER_BOTTOM_LEFT =
#

UNICODE_DOUBLE_BORDER_BOTTOM_LEFT

#
''
UNICODE_DOUBLE_BORDER_BOTTOM_RIGHT =
#

UNICODE_DOUBLE_BORDER_BOTTOM_RIGHT

#
''
Table =
#

Add an “alias” called Table next.

#
AsciiTable

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.[](i = 12) ⇒ Object

#

AsciiParadise[]

This is an alias towards one of the registered methods listed above.

If it can not be found, we will use the last else clause and delegate to AsciiParadise.ascii_counter() instead.

#


146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/ascii_paradise/toplevel_methods/run_this_animated_component.rb', line 146

def self.[](i = 12)
  _ = available_ascii_components?
  case i
  when 'random','', # empty string also invokes random, as of Nov 2015.
       /^run(_|-)?random(_|-)?animation$/i
    run_random_animation
  else
    if i.to_s =~ /^\d+$/
      run_this_animated_component(
        _[i.to_i - 1]
      )
    else
      run_this_animated_component(i)
    end
  end
end

.airbus(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.airbus

#


39
40
41
# File 'lib/ascii_paradise/animations/airbus.rb', line 39

def self.airbus(commandline_arguments = ARGV)
  Airbus.new(commandline_arguments)
end

.AirbusObject

#

AsciiParadise.Airbus

#


32
33
34
# File 'lib/ascii_paradise/animations/airbus.rb', line 32

def self.Airbus
  Airbus
end

.airplane_fight(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.airplane_fight

#


39
40
41
# File 'lib/ascii_paradise/animations/airplane_fight.rb', line 39

def self.airplane_fight(commandline_arguments = ARGV)
  AirplaneFight.new(commandline_arguments)
end

.airplane_over_forest(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.airplane_over_forest

#


39
40
41
# File 'lib/ascii_paradise/animations/airplane_over_forest.rb', line 39

def self.airplane_over_forest(commandline_arguments = ARGV)
  AirplaneOverForest.new(commandline_arguments)
end

.AirplaneFightObject

#

AsciiParadise.AirplaneFight

#


32
33
34
# File 'lib/ascii_paradise/animations/airplane_fight.rb', line 32

def self.AirplaneFight
  AirplaneFight
end

.AirplaneOverForestObject

#

AsciiParadise.AirplaneOverForest

#


32
33
34
# File 'lib/ascii_paradise/animations/airplane_over_forest.rb', line 32

def self.AirplaneOverForest
  AirplaneOverForest
end

.animated_clock(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.animated_clock

#


40
41
42
# File 'lib/ascii_paradise/animations/animated_clock.rb', line 40

def self.animated_clock(commandline_arguments = ARGV)
  AnimatedClock.new(commandline_arguments)
end

.animated_duckObject

#

AsciiParadise.animated_duck

#


47
48
49
# File 'lib/ascii_paradise/animations/animated_duck.rb', line 47

def self.animated_duck
  AsciiParadise::AnimatedDuck.new
end

.animated_pacmanObject

#

AsciiParadise.animated_pacman

#


62
63
64
# File 'lib/ascii_paradise/animations/animated_pacman.rb', line 62

def self.animated_pacman
  AsciiParadise::AnimatedPacman.new
end

.animated_progress_barObject

#

AsciiParadise.animated_progress_bar

#


123
124
125
# File 'lib/ascii_paradise/animations/animated_progress_bar.rb', line 123

def self.animated_progress_bar
  AsciiParadise::AnimatedProgressBar.new
end

.AnimatedClockObject

#

AsciiParadise.AnimatedClock

#


33
34
35
# File 'lib/ascii_paradise/animations/animated_clock.rb', line 33

def self.AnimatedClock
  AnimatedClock
end

.animatedpacmanObject

#

AsciiParadise.animatedpacman

#


69
70
71
# File 'lib/ascii_paradise/animations/animated_pacman.rb', line 69

def self.animatedpacman
  AsciiParadise::AnimatedPacman
end

.animatedprogressbarObject

#

AsciiParadise.animatedprogressbar

#


130
131
132
# File 'lib/ascii_paradise/animations/animated_progress_bar.rb', line 130

def self.animatedprogressbar
  AsciiParadise::AnimatedProgressBar
end

.animations_directory?Boolean

#

AsciiParadise.animations_directory?

Where all animations will be kept.

#

Returns:

  • (Boolean)


40
41
42
# File 'lib/ascii_paradise/project/project.rb', line 40

def self.animations_directory?
  "#{project_base_directory?}animations/"
end

.anti_air(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.anti_air

#


38
39
40
# File 'lib/ascii_paradise/animations/anti_air.rb', line 38

def self.anti_air(commandline_arguments = ARGV)
  AntiAir.new(commandline_arguments)
end

.AntiAirObject

#

AsciiParadise.AntiAir

#


31
32
33
# File 'lib/ascii_paradise/animations/anti_air.rb', line 31

def self.AntiAir
  AntiAir
end

.aquarium(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.aquarium

#


39
40
41
# File 'lib/ascii_paradise/animations/aquarium.rb', line 39

def self.aquarium(commandline_arguments = ARGV)
  Aquarium.new(commandline_arguments)
end

.AquariumObject

#

AsciiParadise.Aquarium

#


32
33
34
# File 'lib/ascii_paradise/animations/aquarium.rb', line 32

def self.Aquarium
  Aquarium
end

.ascii_box(msg_content = 'Hello World!') ⇒ Object

#

AsciiParadise.ascii_box ‘Hello World!’

#


291
292
293
# File 'lib/ascii_paradise/static_ascii/box.rb', line 291

def self.ascii_box(msg_content = 'Hello World!')
  AsciiParadise::Box.new(msg_content).report
end

.ascii_circle(radius = 5) ⇒ Object

#

AsciiParadise.ascii_circle

We draw an ascii circle here. We can pass the radius as its first argument.

#


230
231
232
# File 'lib/ascii_paradise/static_ascii/circle.rb', line 230

def self.ascii_circle(radius = 5)
  AsciiParadise::Circle.new(radius, 1.0, '#').display
end

.ascii_counter(count_down_from = 50) ⇒ Object

#

AsciiParadise.ascii_counter

#


121
122
123
# File 'lib/ascii_paradise/animations/counter.rb', line 121

def self.ascii_counter(count_down_from = 50)
  AsciiParadise::Counter.new(count_down_from)
end

.ascii_heart(size = '12') ⇒ Object

#

AsciiParadise.ascii_heart ‘Hello World!’

#


144
145
146
# File 'lib/ascii_paradise/static_ascii/heart.rb', line 144

def self.ascii_heart(size = '12')
  AsciiParadise::Heart.draw_heart(size)
end

.ascii_say(i = 'Hello world!', use_which_subcomponent = :random) ⇒ Object

#

AsciiParadise.ascii_say

Use a simplified ascii-talker, a bit like in a cartoon.

The second argument of this method tells us which subcomponent is to be used.

Usage examples:

AsciiParadise.say 'Yo there how do you do?', :wizard
#


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/ascii_paradise/ascii_say/say.rb', line 25

def self.ascii_say(
    i                      = 'Hello world!',
    use_which_subcomponent = :random
  )
  if i.is_a? Array
    i = i.join(' ')
  end
  case use_which_subcomponent.to_sym
  # ======================================================================= #
  # === :random
  #
  # This entry point will list all possible components that respond
  # to .say().
  # ======================================================================= #
  when :random
    array = [
      AsciiParadise::Alien,
      AsciiParadise::Buddha,
      AsciiParadise::CatInTheHat,
      AsciiParadise::DomeTent,
      AsciiParadise::FlowerDecoration,
      AsciiParadise::Wizard,
      AsciiParadise::Knight,
      AsciiParadise::SexyAngel,
      AsciiParadise::Cowsay,
      AsciiParadise::Ponysay
    ]
    subcomponent_to_use = array.sample
  # ======================================================================= #
  # === :alien
  # ======================================================================= #
  when :alien
    subcomponent_to_use = AsciiParadise::Alien
  # ======================================================================= #
  # === :buddha
  # ======================================================================= #
  when :buddha
    subcomponent_to_use = AsciiParadise::Buddha
  # ======================================================================= #
  # === :dome_tent
  # ======================================================================= #
  when :dome_tent,
       :tent
    subcomponent_to_use = AsciiParadise::DomeTent
  # ======================================================================= #
  # === :flower
  # ======================================================================= #
  when :flower,
       :flower_decoration
    subcomponent_to_use = AsciiParadise::FlowerDecoration
  # ======================================================================= #
  # === :cat
  # ======================================================================= #
  when :cat,
       :cat_in_the_hat
    subcomponent_to_use = AsciiParadise::CatInTheHat
  # ======================================================================= #
  # === :wizard
  # ======================================================================= #
  when :wizard
    subcomponent_to_use = AsciiParadise::Wizard
  # ======================================================================= #
  # === :knight
  # ======================================================================= #
  when :knight
    subcomponent_to_use = AsciiParadise::Knight
  # ======================================================================= #
  # === :sexy_angel
  # ======================================================================= #
  when :sexy_angel
    subcomponent_to_use = AsciiParadise::SexyAngel
  # ======================================================================= #
  # === :cowsay
  # ======================================================================= #
  when :cowsay,
       :cow
    subcomponent_to_use = AsciiParadise::Cowsay
  # ======================================================================= #
  # === :ponysay
  # ======================================================================= #
  when :ponysay,
       :pony
    subcomponent_to_use = AsciiParadise::Ponysay
  end
  subcomponent_to_use.say i
end

.ask_the_user_which_component_should_be_run_nextObject

#

AsciiParadise.ask_the_user_which_component_should_be_run_next

We will ask the user which component should be run next.

#


77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/ascii_paradise/interactive/interactive.rb', line 77

def self.ask_the_user_which_component_should_be_run_next
  e
  e 'Input your command next. Input "help" or "h" to get all options and'
  e '"exit" or "q" to exit from this user input loop again.'
  e 
  return_value = loop {
    user_input = $stdin.gets.chomp.strip
    # ===================================================================== #
    # === Downcase it next
    # ===================================================================== #
    user_input.downcase!
    case user_input # case tag
    # ===================================================================== #
    # === clear
    # ===================================================================== #
    when /^clear$/i
      e 'Clearing colour assignments next.'
      clear_colours
    # ===================================================================== #
    # === help
    # ===================================================================== #
    when /^-?-?help$/i,'h'
      show_interactive_help
    # ===================================================================== #
    # === exit
    # ===================================================================== #
    when 'exit','q'
      e 'Exiting now.'
      exit
    else # Else the user did input something. We will evaluate this.
      if ::Colours.does_include? user_input
        e 'Now using Colours. '+user_input+' colour.'
        @colour = user_input
      else
        components = ::AsciiParadise.return_all_animated_ascii_components
        result = nil
        # possible_match =
        #   result.map {|entry| entry.to_s }.select {|entry| entry.include? user_input }
        # =================================================================== #
        # === First check if it is a number
        # =================================================================== #
        if user_input =~ /^\d+$/
          result = components[user_input.to_i - 1]
        # =================================================================== #
        # === Check if the input is part of the component
        # =================================================================== #
        # elsif !possible_match.empty? # Not enable dfor now.
        # else # Else we did not find anything.
        end
        if result
          _ = nil
          if @colour
            _ = '--use-this-colour='+@colour.to_s
          end
          result.new(_) # Instantiate it here.
        end
      end
    end
  }
  return return_value
end

.attractive_ladyObject

#

AsciiParadise.attractive_lady

#


31
32
33
# File 'lib/ascii_paradise/static_ascii/attractive_lady.rb', line 31

def self.attractive_lady
  AsciiParadise::AttractiveLady.new
end

.attractiveladyObject

#

AsciiParadise.attractivelady

#


38
39
40
# File 'lib/ascii_paradise/static_ascii/attractive_lady.rb', line 38

def self.attractivelady
  AsciiParadise::AttractiveLady
end

.available_ascii_components?Boolean

#

AsciiParadise.available_ascii_components?

This will return a sorted Array which will have all the ascii components that are available.

This Array will look like so:

["AirplaneOverForest", "AnimatedCigarette"] # And so on.
#

Returns:

  • (Boolean)


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/ascii_paradise/toplevel_methods/available_ascii_components.rb', line 26

def self.available_ascii_components?
  target = ::AsciiParadise.animations_directory?
  array = []
  Dir["#{target}*.rb"].each {|file|
    _ = File.basename(file).
        gsub(/ascii_/,'').
        sub(/\.rb$/,'').capitalize
    # ===================================================================== #
    # Camelcase it:
    # ===================================================================== #
    if _.include? '_'
      _ = _.split('_').map {|entry| entry.capitalize }.join
    end
    array << _
  }
  array.sort # Must sort it alphabetically.
end

.available_ascii_components_optionsObject

#

AsciiParadise.available_ascii_components_options

The Array that will be returned here, is used in a case-when menu elsewhere. It is used to determine which options are applicable in order to show the available ascii components of this project.

#


17
18
19
20
21
22
23
24
25
26
# File 'lib/ascii_paradise/toplevel_methods/available_ascii_components_options.rb', line 17

def self.available_ascii_components_options
  %w(
    --available
    --show-available
    --showavailable
    --overview
    overview
    show-available
  ) 
end

.baby_dragon(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.baby_dragon

#


39
40
41
# File 'lib/ascii_paradise/animations/baby_dragon.rb', line 39

def self.baby_dragon(commandline_arguments = ARGV)
  BabyDragon.new(commandline_arguments)
end

.BabyDragonObject

#

AsciiParadise.BabyDragon

#


32
33
34
# File 'lib/ascii_paradise/animations/baby_dragon.rb', line 32

def self.BabyDragon
  BabyDragon
end

.backflip(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.backflip

#


39
40
41
# File 'lib/ascii_paradise/animations/backflip.rb', line 39

def self.backflip(commandline_arguments = ARGV)
  Backflip.new(commandline_arguments)
end

.BackflipObject

#

AsciiParadise.Backflip

#


32
33
34
# File 'lib/ascii_paradise/animations/backflip.rb', line 32

def self.Backflip
  Backflip
end

.ball_bounces_against_wall(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.ball_bounces_against_wall

#


40
41
42
# File 'lib/ascii_paradise/animations/ball_bounces_against_wall.rb', line 40

def self.ball_bounces_against_wall(commandline_arguments = ARGV)
  BallBouncesAgainstWall.new(commandline_arguments)
end

.ball_factory(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.ball_factory

#


39
40
41
# File 'lib/ascii_paradise/animations/ball_factory.rb', line 39

def self.ball_factory(commandline_arguments = ARGV)
  BallFactory.new(commandline_arguments)
end

.BallBouncesAgainstWallObject

#

AsciiParadise.BallBouncesAgainstWall

#


33
34
35
# File 'lib/ascii_paradise/animations/ball_bounces_against_wall.rb', line 33

def self.BallBouncesAgainstWall
  BallBouncesAgainstWall
end

.BallFactoryObject

#

AsciiParadise.BallFactory

#


32
33
34
# File 'lib/ascii_paradise/animations/ball_factory.rb', line 32

def self.BallFactory
  BallFactory
end

.basketball(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.basketball

#


39
40
41
# File 'lib/ascii_paradise/animations/basketball.rb', line 39

def self.basketball(commandline_arguments = ARGV)
  Basketball.new(commandline_arguments)
end

.BasketballObject

#

AsciiParadise.Basketball

#


32
33
34
# File 'lib/ascii_paradise/animations/basketball.rb', line 32

def self.Basketball
  Basketball
end

.basketball_game(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.basketball_game

#


39
40
41
# File 'lib/ascii_paradise/animations/basketball_game.rb', line 39

def self.basketball_game(commandline_arguments = ARGV)
  BasketballGame.new(commandline_arguments)
end

.BasketballGameObject

#

AsciiParadise.BasketballGame

#


32
33
34
# File 'lib/ascii_paradise/animations/basketball_game.rb', line 32

def self.BasketballGame
  BasketballGame
end

.beautiful_patternObject

#

AsciiParadise.beautiful_pattern

#


48
49
50
# File 'lib/ascii_paradise/static_ascii/beautiful_pattern.rb', line 48

def self.beautiful_pattern
  AsciiParadise::BeautifulPattern.new
end

.BeautifulPatternObject

#

AsciiParadise.BeautifulPattern

#


55
56
57
# File 'lib/ascii_paradise/static_ascii/beautiful_pattern.rb', line 55

def self.BeautifulPattern
  AsciiParadise::BeautifulPattern
end

.biker_and_snail(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.biker_and_snail

#


40
41
42
# File 'lib/ascii_paradise/animations/biker_and_snail.rb', line 40

def self.biker_and_snail(commandline_arguments = ARGV)
  BikerAndSnail.new(commandline_arguments)
end

.BikerAndSnailObject

#

AsciiParadise.BikerAndSnail

#


33
34
35
# File 'lib/ascii_paradise/animations/biker_and_snail.rb', line 33

def self.BikerAndSnail
  BikerAndSnail
end

.BirdObject

#

AsciiParadise.Bird

#


32
33
34
# File 'lib/ascii_paradise/animations/bird.rb', line 32

def self.Bird
  Bird
end

.bird(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.bird

#


39
40
41
# File 'lib/ascii_paradise/animations/bird.rb', line 39

def self.bird(commandline_arguments = ARGV)
  Bird.new(commandline_arguments)
end

.bird_attack(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.bird_attack

#


39
40
41
# File 'lib/ascii_paradise/animations/bird_attack.rb', line 39

def self.bird_attack(commandline_arguments = ARGV)
  BirdAttack.new(commandline_arguments)
end

.BirdAttackObject

#

AsciiParadise.BirdAttack

#


32
33
34
# File 'lib/ascii_paradise/animations/bird_attack.rb', line 32

def self.BirdAttack
  BirdAttack
end

.block_breaker(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.block_breaker

#


39
40
41
# File 'lib/ascii_paradise/animations/block_breaker.rb', line 39

def self.block_breaker(commandline_arguments = ARGV)
  BlockBreaker.new(commandline_arguments)
end

.BlockBreakerObject

#

AsciiParadise.BlockBreaker

#


32
33
34
# File 'lib/ascii_paradise/animations/block_breaker.rb', line 32

def self.BlockBreaker
  BlockBreaker
end

.body_builders(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.body_builders

#


39
40
41
# File 'lib/ascii_paradise/animations/body_builders.rb', line 39

def self.body_builders(commandline_arguments = ARGV)
  BodyBuilders.new(commandline_arguments)
end

.BodyBuildersObject

#

AsciiParadise.BodyBuilders

#


32
33
34
# File 'lib/ascii_paradise/animations/body_builders.rb', line 32

def self.BodyBuilders
  BodyBuilders
end

.BoomerangObject

#

AsciiParadise.Boomerang

#


32
33
34
# File 'lib/ascii_paradise/animations/boomerang.rb', line 32

def self.Boomerang
  Boomerang
end

.boomerang(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.boomerang

#


39
40
41
# File 'lib/ascii_paradise/animations/boomerang.rb', line 39

def self.boomerang(commandline_arguments = ARGV)
  Boomerang.new(commandline_arguments)
end

.bouncing_ball(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.bouncing_ball

#


39
40
41
# File 'lib/ascii_paradise/animations/bouncing_ball.rb', line 39

def self.bouncing_ball(commandline_arguments = ARGV)
  BouncingBall.new(commandline_arguments)
end

.BouncingBallObject

#

AsciiParadise.BouncingBall

#


32
33
34
# File 'lib/ascii_paradise/animations/bouncing_ball.rb', line 32

def self.BouncingBall
  BouncingBall
end

.bouncy_ball(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.bouncy_ball

#


39
40
41
# File 'lib/ascii_paradise/animations/bouncy_ball.rb', line 39

def self.bouncy_ball(commandline_arguments = ARGV)
  BouncyBall.new(commandline_arguments)
end

.bouncy_exploding_ball(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.bouncy_exploding_ball

#


39
40
41
# File 'lib/ascii_paradise/animations/bouncy_exploding_ball.rb', line 39

def self.bouncy_exploding_ball(commandline_arguments = ARGV)
  BouncyExplodingBall.new(commandline_arguments)
end

.BouncyBallObject

#

AsciiParadise.BouncyBall

#


32
33
34
# File 'lib/ascii_paradise/animations/bouncy_ball.rb', line 32

def self.BouncyBall
  BouncyBall
end

.BouncyExplodingBallObject

#

AsciiParadise.BouncyExplodingBall

#


32
33
34
# File 'lib/ascii_paradise/animations/bouncy_exploding_ball.rb', line 32

def self.BouncyExplodingBall
  BouncyExplodingBall
end

.BoxObject

#

AsciiParadise.Box

#


298
299
300
# File 'lib/ascii_paradise/static_ascii/box.rb', line 298

def self.Box
  AsciiParadise::Box
end

.breaking_glass(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.breaking_glass

#


39
40
41
# File 'lib/ascii_paradise/animations/breaking_glass.rb', line 39

def self.breaking_glass(commandline_arguments = ARGV)
  BreakingGlass.new(commandline_arguments)
end

.BreakingGlassObject

#

AsciiParadise.BreakingGlass

#


32
33
34
# File 'lib/ascii_paradise/animations/breaking_glass.rb', line 32

def self.BreakingGlass
  BreakingGlass
end

.bubble_dragon(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.bubble_dragon

#


39
40
41
# File 'lib/ascii_paradise/animations/bubble_dragon.rb', line 39

def self.bubble_dragon(commandline_arguments = ARGV)
  BubbleDragon.new(commandline_arguments)
end

.BubbleDragonObject

#

AsciiParadise.BubbleDragon

#


32
33
34
# File 'lib/ascii_paradise/animations/bubble_dragon.rb', line 32

def self.BubbleDragon
  BubbleDragon
end

.BunniesObject

#

AsciiParadise.Bunnies

#


32
33
34
# File 'lib/ascii_paradise/animations/bunnies.rb', line 32

def self.Bunnies
  Bunnies
end

.bunnies(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.bunnies

#


39
40
41
# File 'lib/ascii_paradise/animations/bunnies.rb', line 39

def self.bunnies(commandline_arguments = ARGV)
  Bunnies.new(commandline_arguments)
end

.BunnycatObject

#

AsciiParadise.Bunnycat

#


32
33
34
# File 'lib/ascii_paradise/animations/bunnycat.rb', line 32

def self.Bunnycat
  Bunnycat
end

.bunnycat(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.bunnycat

#


39
40
41
# File 'lib/ascii_paradise/animations/bunnycat.rb', line 39

def self.bunnycat(commandline_arguments = ARGV)
  Bunnycat.new(commandline_arguments)
end

.canadian_flag(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.canadian_flag

#


39
40
41
# File 'lib/ascii_paradise/animations/canadian_flag.rb', line 39

def self.canadian_flag(commandline_arguments = ARGV)
  CanadianFlag.new(commandline_arguments)
end

.CanadianFlagObject

#

AsciiParadise.CanadianFlag

#


32
33
34
# File 'lib/ascii_paradise/animations/canadian_flag.rb', line 32

def self.CanadianFlag
  CanadianFlag
end

.car_production(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.car_production

#


39
40
41
# File 'lib/ascii_paradise/animations/car_production.rb', line 39

def self.car_production(commandline_arguments = ARGV)
  CarProduction.new(commandline_arguments)
end

.CarProductionObject

#

AsciiParadise.CarProduction

#


32
33
34
# File 'lib/ascii_paradise/animations/car_production.rb', line 32

def self.CarProduction
  CarProduction
end

.cat_faceObject

#

AsciiParadise.cat_face

#


28
29
30
# File 'lib/ascii_paradise/static_ascii/cat_face.rb', line 28

def self.cat_face
  AsciiParadise::CatFace.new
end

.catch_the_ball(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.catch_the_ball

#


39
40
41
# File 'lib/ascii_paradise/animations/catch_the_ball.rb', line 39

def self.catch_the_ball(commandline_arguments = ARGV)
  CatchTheBall.new(commandline_arguments)
end

.CatchTheBallObject

#

AsciiParadise.CatchTheBall

#


32
33
34
# File 'lib/ascii_paradise/animations/catch_the_ball.rb', line 32

def self.CatchTheBall
  CatchTheBall
end

.CatFaceObject

#

AsciiParadise.CatFace

#


35
36
37
# File 'lib/ascii_paradise/static_ascii/cat_face.rb', line 35

def self.CatFace
  AsciiParadise::CatFace
end

.chopper(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.chopper

#


39
40
41
# File 'lib/ascii_paradise/animations/chopper.rb', line 39

def self.chopper(commandline_arguments = ARGV)
  Chopper.new(commandline_arguments)
end

.ChopperObject

#

AsciiParadise.Chopper

#


32
33
34
# File 'lib/ascii_paradise/animations/chopper.rb', line 32

def self.Chopper
  Chopper
end

.CigaretteObject

#

AsciiParadise.Cigarette

#


32
33
34
# File 'lib/ascii_paradise/animations/cigarette.rb', line 32

def self.Cigarette
  Cigarette
end

.cigarette(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.cigarette

#


39
40
41
# File 'lib/ascii_paradise/animations/cigarette.rb', line 39

def self.cigarette(commandline_arguments = ARGV)
  Cigarette.new(commandline_arguments)
end

.CircleObject

#

AsciiParadise.Circle

#


237
238
239
# File 'lib/ascii_paradise/static_ascii/circle.rb', line 237

def self.Circle
  AsciiParadise::Circle
end

.circle_of_life(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.circle_of_life

#


32
33
34
# File 'lib/ascii_paradise/animations/circle_of_life.rb', line 32

def self.circle_of_life(commandline_arguments = ARGV)
  CircleOfLife.new(commandline_arguments)
end

.CircleOfLifeObject

#

AsciiParadise.CircleOfLife

#


39
40
41
# File 'lib/ascii_paradise/animations/circle_of_life.rb', line 39

def self.CircleOfLife
  CircleOfLife
end

.clear_coloursObject

#

AsciiParadise.clear_colours

#


43
44
45
# File 'lib/ascii_paradise/colours/colours.rb', line 43

def self.clear_colours
  AsciiParadise.set_colour(nil)
end

.clear_screenObject

#

AsciiParadise.clear_screen

Simply perform ‘clear’ here.

#


14
15
16
# File 'lib/ascii_paradise/toplevel_methods/clear_screen.rb', line 14

def self.clear_screen
  system 'clear'
end

.coin_roll(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.coin_roll

#


40
41
42
# File 'lib/ascii_paradise/animations/coin_roll.rb', line 40

def self.coin_roll(commandline_arguments = ARGV)
  CoinRoll.new(commandline_arguments)
end

.CoinRollObject

#

AsciiParadise.CoinRoll

#


33
34
35
# File 'lib/ascii_paradise/animations/coin_roll.rb', line 33

def self.CoinRoll
  CoinRoll
end

.colour?Boolean

#

AsciiParadise.colour?

#

Returns:

  • (Boolean)


29
30
31
# File 'lib/ascii_paradise/colours/colours.rb', line 29

def self.colour?
  @colour
end

.colour_parse_this_string(i) ⇒ Object

#

AsciiParadise.colour_parse_this_string

This method can take an existing String and replace all html colour tags, such as <steelblue>, with the corresponding ASCII escape code, on the commandline.

#


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/ascii_paradise/toplevel_methods/colour_parse_this_string.rb', line 21

def self.colour_parse_this_string(i)
  if i.is_a? Array
    i = i.first
  end
  if i and File.file?(i)
    i = File.readlines(i)
  end
  if i.is_a? String
    i = i.split("\n")
  end
  i.map! {|entry|
    if ::Colours.does_this_line_include_a_html_colour?(entry)
      # =================================================================== #
      # The line contains a HTML colour, so let's parse it.
      # =================================================================== #
      entry = ::Colours.replace_all_html_colours_in_this_line(entry, :default, :revert)
    end
    entry
  }
  if i.is_a? Array
    i = i.join
  end
  i
end

.colourful_flowersObject

#

AsciiParadise.colourful_flowers

#


50
51
52
# File 'lib/ascii_paradise/static_ascii/colourful_flowers.rb', line 50

def self.colourful_flowers
  AsciiParadise::ColourfulFlowers.run
end

.ColourfulFlowersObject

#

AsciiParadise.ColourfulFlowers

#


58
59
60
# File 'lib/ascii_paradise/static_ascii/colourful_flowers.rb', line 58

def self.ColourfulFlowers
  AsciiParadise::ColourfulFlowers
end

.CounterObject

#

AsciiParadise.Counter

#


128
129
130
# File 'lib/ascii_paradise/animations/counter.rb', line 128

def self.Counter
  AsciiParadise::Counter
end

.cowsay(i = 'Hello world!') ⇒ Object

#

AsciiParadise.cowsay

The ascii cow will say the given text.

Invocation example:

AsciiParadise.cowsay 'I am a happy cow!'
#


124
125
126
# File 'lib/ascii_paradise/ascii_say/say.rb', line 124

def self.cowsay(i = 'Hello world!')
  say(i, :cow)
end

.dancing_girl(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.dancing_girl

#


39
40
41
# File 'lib/ascii_paradise/animations/dancing_girl.rb', line 39

def self.dancing_girl(commandline_arguments = ARGV)
  DancingGirl.new(commandline_arguments)
end

.DancingGirlObject

#

AsciiParadise.DancingGirl

#


32
33
34
# File 'lib/ascii_paradise/animations/dancing_girl.rb', line 32

def self.DancingGirl
  DancingGirl
end

.debug?Boolean

#

AsciiParadise.debug?

Query the debug value here.

#

Returns:

  • (Boolean)


22
23
24
# File 'lib/ascii_paradise/debug/debug.rb', line 22

def self.debug?
  @debug
end

.demo(delay = 12) ⇒ Object

#

AsciiParadise.demo (demo tag, test tag)

We can use this method to demo what the AsciiParadise is capable of doing.

#


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/ascii_paradise/demo/demo.rb', line 21

def self.demo(delay = 12) # 12 Seconds between individual runs.
  if delay.is_a? Hash
    if delay.has_key? :delay
      delay = delay.delete :delay
    end
  end
  e 'We will next test the various components of the AsciiParadise project.'
  e
  e 'We will display a short header to explain which component we will test.'
  e
  e 'Next we test '+sfancy('AsciiParadise.seductive_lady')+':'
  AsciiParadise.seductive_lady
  e 'Next we test '+sfancy('AsciiParadise.attractive_lady')+':'
  AsciiParadise.attractive_lady
  # ======================================================================= #
  # === Next, show the Mona Lisa, as ASCII art.
  # ======================================================================= #
  e 
  e 'Next, we show the Mona Lisa, via AsciiParadise.mona_lisa'
  e AsciiParadise.mona_lisa
  e
  # ======================================================================= #
  # === Next, showing the pink panther.
  # ======================================================================= #
  e
  e 'Next, showing the the pink panther:'
  AsciiParadise.pink_panther
  e
  e 'Next we try '+sfancy('AsciiParadise.ascii_counter')+':'
  AsciiParadise.ascii_counter(delay)
  e # Need this newline here.
  e 'Next we test '+sfancy('AsciiParadise.ascii_box')+':'
  AsciiParadise.ascii_box ['Hello World!', 'what a big world']
  e 'Next we test '+sfancy('AsciiParadise.draw_heart')+':'
  AsciiParadise.draw_heart size: 25
  e 'Next we test '+sfancy('AsciiParadise.sierpinski_triangle (size: 25)')+':'
  AsciiParadise.sierpinski_triangle size: 25
  e 'Next we test '+sfancy('AsciiParadise.beautiful_pattern')+':'
  AsciiParadise.beautiful_pattern
  e
  e 'Next we test '+sfancy('AsciiParadise.ascii_circle')+': (radius will be 25)'
  AsciiParadise.ascii_circle(25)
  e
  e 'Next we test AsciiParadise.progress_bar:'
  AsciiParadise.progress_bar
  e
  e 'Next we test AsciiParadise.rotating_slash:'
  AsciiParadise.rotating_slash
  e 'Next we test AsciiParadise.rotating_dna :dna:'
  AsciiParadise.rotating_dna :dna
  e
  e 'Next we test AsciiParadise.rotating_dna :star:'
  AsciiParadise.rotating_dna :star
  # =========================================================================== #
  # === ASCII Animations
  #
  # At this point come the various ASCII-animations.
  # =========================================================================== #
  e 'Next we test AsciiParadise.volcano:'
  AsciiParadise.volcano {{ run_n_times: 10 }} # Run 10 times.
  e 'Next we test AsciiParadise.earth:'
  AsciiParadise.earth   {{ run_n_times:  6 }}
  e 'Next we test AsciiParadise.steamer:'
  AsciiParadise.steamer {{ run_n_times:  6 }}
  e 'Next we test AsciiParadise.animated_clock:'
  AsciiParadise.animated_clock {{ run_n_times: 10 }} # Run 10 times.
  e 'Next we test AsciiParadise.bubble_dragon:'
  AsciiParadise.bubble_dragon_animation
  e 'Next we test AsciiParadise.swimming_lane:'
  AsciiParadise.swimming_lane
  e 'Next we test AsciiParadise.animated_cigarette:'
  AsciiParadise.animated_cigarette
  e 'Next we test AsciiParadise.animated_pacman:'
  AsciiParadise.animated_pacman
  e 'Next we test AsciiParadise.animated_duck:'
  AsciiParadise.animated_duck
  e 'Next testing animated progress bar'
  AsciiParadise.animated_progress_bar
  e 'Next we test AsciiParadise.dancing_girl (we will wait 8 seconds before doing so):'
  sleep delay
  AsciiParadise.dancing_girl
  # Pacman-dance also blocks the screen.
  e 'Next we test AsciiParadise.static_pacman:'
  AsciiParadise.static_pacman
  e 'Next, table flip:'
  AsciiParadise.table_flip
end

.digital_clock(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.digital_clock

#


39
40
41
# File 'lib/ascii_paradise/animations/digital_clock.rb', line 39

def self.digital_clock(commandline_arguments = ARGV)
  DigitalClock.new(commandline_arguments)
end

.DigitalClockObject

#

AsciiParadise.DigitalClock

#


32
33
34
# File 'lib/ascii_paradise/animations/digital_clock.rb', line 32

def self.DigitalClock
  DigitalClock
end

.disable_debugObject

#

AsciiParadise.disable_debug

#


29
30
31
# File 'lib/ascii_paradise/debug/debug.rb', line 29

def self.disable_debug
  @debug = false
end

.diver(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.diver

#


39
40
41
# File 'lib/ascii_paradise/animations/diver.rb', line 39

def self.diver(commandline_arguments = ARGV)
  Diver.new(commandline_arguments)
end

.DiverObject

#

AsciiParadise.Diver

#


32
33
34
# File 'lib/ascii_paradise/animations/diver.rb', line 32

def self.Diver
  Diver
end

.dog_tries_to_catch_the_ball(commandline_arguments) ⇒ Object

#

AsciiParadise.dog_tries_to_catch_the_ball

#


39
40
41
# File 'lib/ascii_paradise/animations/dog_tries_to_catch_the_ball.rb', line 39

def self.dog_tries_to_catch_the_ball(commandline_arguments)
  DogTriesToCatchTheBall.new(commandline_arguments)
end

.DogTriesToCatchTheBallObject

#

AsciiParadise.DogTriesToCatchTheBall

#


32
33
34
# File 'lib/ascii_paradise/animations/dog_tries_to_catch_the_ball.rb', line 32

def self.DogTriesToCatchTheBall
  DogTriesToCatchTheBall
end

.dot_factory(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.dot_factory

#


40
41
42
# File 'lib/ascii_paradise/animations/dot_factory.rb', line 40

def self.dot_factory(commandline_arguments = ARGV)
  DotFactory.new(commandline_arguments)
end

.DotFactoryObject

#

AsciiParadise.DotFactory

#


33
34
35
# File 'lib/ascii_paradise/animations/dot_factory.rb', line 33

def self.DotFactory
  DotFactory
end

.driving_car(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.driving_car

#


39
40
41
# File 'lib/ascii_paradise/animations/driving_car.rb', line 39

def self.driving_car(commandline_arguments = ARGV)
  DrivingCar.new(commandline_arguments)
end

.DrivingCarObject

#

AsciiParadise.DrivingCar

#


32
33
34
# File 'lib/ascii_paradise/animations/driving_car.rb', line 32

def self.DrivingCar
  DrivingCar
end

.e(i = '') ⇒ Object

#

AsciiParadise.e

#


12
13
14
# File 'lib/ascii_paradise/toplevel_methods/e.rb', line 12

def self.e(i = '')
  puts i
end

.EarthObject

#

AsciiParadise.Earth

#


32
33
34
# File 'lib/ascii_paradise/animations/earth.rb', line 32

def self.Earth
  Earth
end

.earth(i = ARGV) ⇒ Object

#

AsciiParadise.earth

#


39
40
41
# File 'lib/ascii_paradise/animations/earth.rb', line 39

def self.earth(i = ARGV)
  Earth.new(i)
end

.efiglet(i) ⇒ Object

#

AsciiParadise.efiglet

This is as figlet(), but it will output the result.

#


78
79
80
# File 'lib/ascii_paradise/toplevel_methods/figlet.rb', line 78

def self.efiglet(i)
  e figlet(i)
end

.embeddable_interfaceObject

#

AsciiParadise.embeddable_interface

#


132
133
134
135
136
137
# File 'lib/ascii_paradise/www/embeddable_interface.rb', line 132

def self.embeddable_interface
  object = Object.new
  object.extend(::AsciiParadise::EmbeddableInterface)
  #object.extend(::HtmlTags)
  return object
end

.enable_debug(optional_be_verbose = false) ⇒ Object

#

AsciiParadise.enable_debug

The first argument determines whether we will give a notification to the user, when he wants to have it. By default, no notification will be made, to lessen the noise-level.

This method will enable debug all across the AsciiParadise components.

#


42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ascii_paradise/debug/debug.rb', line 42

def self.enable_debug(
    optional_be_verbose = false
  )
  case optional_be_verbose
  when :be_verbose
    optional_be_verbose = true
  end
  if optional_be_verbose
    e 'We will now debug when we run code from the AsciiParadise project.'
  end
  @debug = true
end

.endless_monkey_bars(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.endless_monkey_bars

#


39
40
41
# File 'lib/ascii_paradise/animations/endless_monkey_bars.rb', line 39

def self.endless_monkey_bars(commandline_arguments = ARGV)
  EndlessMonkeyBars.new(commandline_arguments)
end

.endless_runner(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.endless_runner

#


40
41
42
# File 'lib/ascii_paradise/animations/endless_runner.rb', line 40

def self.endless_runner(commandline_arguments = ARGV)
  EndlessRunner.new(commandline_arguments)
end

.EndlessMonkeyBarsObject

#

AsciiParadise.EndlessMonkeyBars

#


32
33
34
# File 'lib/ascii_paradise/animations/endless_monkey_bars.rb', line 32

def self.EndlessMonkeyBars
  EndlessMonkeyBars
end

.EndlessRunnerObject

#

AsciiParadise.EndlessRunner

#


33
34
35
# File 'lib/ascii_paradise/animations/endless_runner.rb', line 33

def self.EndlessRunner
  EndlessRunner
end

.exploding_alien(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.exploding_alien

#


39
40
41
# File 'lib/ascii_paradise/animations/exploding_alien.rb', line 39

def self.exploding_alien(commandline_arguments = ARGV)
  ExplodingAlien.new(commandline_arguments)
end

.exploding_bubbles(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.exploding_bubbles

#


39
40
41
# File 'lib/ascii_paradise/animations/exploding_bubbles.rb', line 39

def self.exploding_bubbles(commandline_arguments = ARGV)
  ExplodingBubbles.new(commandline_arguments)
end

.ExplodingAlienObject

#

AsciiParadise.ExplodingAlien

#


32
33
34
# File 'lib/ascii_paradise/animations/exploding_alien.rb', line 32

def self.ExplodingAlien
  ExplodingAlien
end

.ExplodingBubblesObject

#

AsciiParadise.ExplodingBubbles

#


32
33
34
# File 'lib/ascii_paradise/animations/exploding_bubbles.rb', line 32

def self.ExplodingBubbles
  ExplodingBubbles
end

.eye_wiggling(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.eye_wiggling

#


39
40
41
# File 'lib/ascii_paradise/animations/eye_wiggling.rb', line 39

def self.eye_wiggling(commandline_arguments = ARGV)
  EyeWiggling.new(commandline_arguments)
end

.EyeWigglingObject

#

AsciiParadise.EyeWiggling

#


32
33
34
# File 'lib/ascii_paradise/animations/eye_wiggling.rb', line 32

def self.EyeWiggling
  EyeWiggling
end

.figlet(i, optional_use_this_font = nil) ⇒ Object

#

AsciiParadise.figlet

This method requires the program called ‘figlet’ installed - otherwise it will not work. If you wish to add more fonts then you can download them from websites such as www.jave.de/figlet/fonts/overview.html or other sites.

Figlet is a text-to-ASCII “symbols” converter. To make use of fonts, you can issue something like this:

figlet -w 120 -f ~/Downloads/broadway.flf

The first argument to this method should be a String. This string will be “figletized” - that is, converted into an ASCII representation.

The second (optional) argument can be used to specify the path to a locally existing .flf file (font file).

Note that this method will return a String.

The following list shows some fonts which I consider as useful; many other fonts are quite crappy, though.

Invocation examples:

AsciiParadise.figlet 'Wikipedia'
AsciiParadise.figlet 'Wikipedia', '3d_diagonal'
AsciiParadise.figlet 'Wikipedia', :acrobatic
AsciiParadise.figlet 'Wikipedia', :alpha
AsciiParadise.figlet 'Wikipedia', :broadway
AsciiParadise.figlet 'Wikipedia', :colossal
AsciiParadise.figlet 'Wikipedia', :doh
AsciiParadise.figlet 'Wikipedia', 'Georgia11'
AsciiParadise.figlet 'Wikipedia', 'pebbles'
AsciiParadise.figlet 'Wikipedia', 'univers'
#


49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/ascii_paradise/toplevel_methods/figlet.rb', line 49

def self.figlet(
    i, optional_use_this_font = nil
  )
  if i.is_a? Array
    i = i.join(' ').strip
  end
  cmd_to_use = 'figlet -t'.dup
  if optional_use_this_font
    unless optional_use_this_font.include? '/'
      # =================================================================== #
      # Use a hardcoded path in this case.
      # =================================================================== #
      optional_use_this_font.prepend('/Depot/jjj/fonts/')
    end
    cmd_to_use << ' -f '+optional_use_this_font.to_s
    unless cmd_to_use.end_with? '.flf'
      cmd_to_use << '.flf'
    end
  end
  cmd_to_use << " #{i}"
  result = `#{cmd_to_use}`
  return result
end

.FireObject

#

AsciiParadise.Fire

#


33
34
35
# File 'lib/ascii_paradise/animations/fire.rb', line 33

def self.Fire
  Fire
end

.fire(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.fire

#


40
41
42
# File 'lib/ascii_paradise/animations/fire.rb', line 40

def self.fire(commandline_arguments = ARGV)
  Fire.new(commandline_arguments)
end

.firework_clock(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.firework_clock

#


39
40
41
# File 'lib/ascii_paradise/animations/firework_clock.rb', line 39

def self.firework_clock(commandline_arguments = ARGV)
  FireworkClock.new(commandline_arguments)
end

.firework_launcher(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.firework_launcher

#


39
40
41
# File 'lib/ascii_paradise/animations/firework_launcher.rb', line 39

def self.firework_launcher(commandline_arguments = ARGV)
  FireworkLauncher.new(commandline_arguments)
end

.FireworkClockObject

#

AsciiParadise.FireworkClock

#


32
33
34
# File 'lib/ascii_paradise/animations/firework_clock.rb', line 32

def self.FireworkClock
  FireworkClock
end

.FireworkLauncherObject

#

AsciiParadise.FireworkLauncher

#


32
33
34
# File 'lib/ascii_paradise/animations/firework_launcher.rb', line 32

def self.FireworkLauncher
  FireworkLauncher
end

.fireworks(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.fireworks

#


39
40
41
# File 'lib/ascii_paradise/animations/fireworks.rb', line 39

def self.fireworks(commandline_arguments = ARGV)
  Fireworks.new(commandline_arguments)
end

.FireworksObject

#

AsciiParadise.Fireworks

#


32
33
34
# File 'lib/ascii_paradise/animations/fireworks.rb', line 32

def self.Fireworks
  Fireworks
end

.flame_thrower(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.flame_thrower

#


39
40
41
# File 'lib/ascii_paradise/animations/flame_thrower.rb', line 39

def self.flame_thrower(commandline_arguments = ARGV)
  FlameThrower.new(commandline_arguments)
end

.FlameThrowerObject

#

AsciiParadise.FlameThrower

#


32
33
34
# File 'lib/ascii_paradise/animations/flame_thrower.rb', line 32

def self.FlameThrower
  FlameThrower
end

.flexbox(i, &block) ⇒ Object

#

AsciiParadise.flexbox

#


1631
1632
1633
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 1631

def self.flexbox(i, &block)
  AsciiParadise::Flexbox.new(i, &block).display
end

.flower_decoration(i = 'Hello world!') ⇒ Object

#

AsciiParadise.flower_decoration

Invocation example:

AsciiParadise.flower_decoration(("Once upon a time ... \n there were three evil witches."*10))
#


150
151
152
# File 'lib/ascii_paradise/ascii_say/say.rb', line 150

def self.flower_decoration(i = 'Hello world!')
  say(i, :flower_decoration)
end

.flying_head(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.flying_head

#


39
40
41
# File 'lib/ascii_paradise/animations/flying_head.rb', line 39

def self.flying_head(commandline_arguments = ARGV)
  FlyingHead.new(commandline_arguments)
end

.FlyingHeadObject

#

AsciiParadise.FlyingHead

#


32
33
34
# File 'lib/ascii_paradise/animations/flying_head.rb', line 32

def self.FlyingHead
  FlyingHead
end

.framerate_walking(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.framerate_walking

#


40
41
42
# File 'lib/ascii_paradise/animations/framerate_walking.rb', line 40

def self.framerate_walking(commandline_arguments = ARGV)
  FramerateWalking.new(commandline_arguments)
end

.FramerateWalkingObject

#

AsciiParadise.FramerateWalking

#


33
34
35
# File 'lib/ascii_paradise/animations/framerate_walking.rb', line 33

def self.FramerateWalking
  FramerateWalking
end

.friendly_monkey(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.friendly_monkey

#


39
40
41
# File 'lib/ascii_paradise/animations/friendly_monkey.rb', line 39

def self.friendly_monkey(commandline_arguments = ARGV)
  FriendlyMonkey.new(commandline_arguments)
end

.FriendlyMonkeyObject

#

AsciiParadise.FriendlyMonkey

#


32
33
34
# File 'lib/ascii_paradise/animations/friendly_monkey.rb', line 32

def self.FriendlyMonkey
  FriendlyMonkey
end

.GargoyleObject

#

AsciiParadise.Gargoyle

#


32
33
34
# File 'lib/ascii_paradise/animations/gargoyle.rb', line 32

def self.Gargoyle
  Gargoyle
end

.gargoyle(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.gargoyle

#


39
40
41
# File 'lib/ascii_paradise/animations/gargoyle.rb', line 39

def self.gargoyle(commandline_arguments = ARGV)
  Gargoyle.new(commandline_arguments)
end

.GenieObject

#

AsciiParadise.Genie

#


32
33
34
# File 'lib/ascii_paradise/animations/genie.rb', line 32

def self.Genie
  Genie
end

.genie(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.genie

#


39
40
41
# File 'lib/ascii_paradise/animations/genie.rb', line 39

def self.genie(commandline_arguments = ARGV)
  Genie.new(commandline_arguments)
end

.good_morning(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.good_morning

#


39
40
41
# File 'lib/ascii_paradise/animations/good_morning.rb', line 39

def self.good_morning(commandline_arguments = ARGV)
  GoodMorning.new(commandline_arguments)
end

.GoodMorningObject

#

AsciiParadise.GoodMorning

#


32
33
34
# File 'lib/ascii_paradise/animations/good_morning.rb', line 32

def self.GoodMorning
  GoodMorning
end

.HadoukenObject

#

AsciiParadise.Hadouken

#


32
33
34
# File 'lib/ascii_paradise/animations/hadouken.rb', line 32

def self.Hadouken
  Hadouken
end

.hadouken(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.hadouken

#


39
40
41
# File 'lib/ascii_paradise/animations/hadouken.rb', line 39

def self.hadouken(commandline_arguments = ARGV)
  Hadouken.new(commandline_arguments)
end

.hand_of_god(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.hand_of_god

#


39
40
41
# File 'lib/ascii_paradise/animations/hand_of_god.rb', line 39

def self.hand_of_god(commandline_arguments = ARGV)
  HandOfGod.new(commandline_arguments)
end

.HandOfGodObject

#

AsciiParadise.HandOfGod

#


32
33
34
# File 'lib/ascii_paradise/animations/hand_of_god.rb', line 32

def self.HandOfGod
  HandOfGod
end

.have_the_animations_files_been_required?Boolean

#

AsciiParadise.have_the_animations_files_been_required?

#

Returns:

  • (Boolean)


20
21
22
# File 'lib/ascii_paradise/requires/require_animations_files.rb', line 20

def self.have_the_animations_files_been_required?
  @have_the_animations_files_been_required
end

.HeartObject

#

AsciiParadise.Heart

#


152
153
154
# File 'lib/ascii_paradise/static_ascii/heart.rb', line 152

def self.Heart
  AsciiParadise::Heart
end

.HourglassObject

#

AsciiParadise.Hourglass

#


32
33
34
# File 'lib/ascii_paradise/animations/hourglass.rb', line 32

def self.Hourglass
  Hourglass
end

.hourglass(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.hourglass

#


39
40
41
# File 'lib/ascii_paradise/animations/hourglass.rb', line 39

def self.hourglass(commandline_arguments = ARGV)
  Hourglass.new(commandline_arguments)
end

.human_factory(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.human_factory

#


40
41
42
# File 'lib/ascii_paradise/animations/human_factory.rb', line 40

def self.human_factory(commandline_arguments = ARGV)
  HumanFactory.new(commandline_arguments)
end

.HumanFactoryObject

#

AsciiParadise.HumanFactory

#


33
34
35
# File 'lib/ascii_paradise/animations/human_factory.rb', line 33

def self.HumanFactory
  HumanFactory
end

.include_this_file?(i) ⇒ Boolean

#

AsciiParadise.include_this_file?

This method can be used to determine whether we do include a specific file. Any ‘-’ tokens in the input will be ignored, thus allowing you to more easily search for the name of the file at hand.

Usage example:

AsciiParadise.include_this_file? '--endless_runner'
AsciiParadise.include_this_file? '--volcano' # => true
#

Returns:

  • (Boolean)


27
28
29
30
31
32
33
# File 'lib/ascii_paradise/toplevel_methods/misc.rb', line 27

def self.include_this_file?(i)
  i = File.basename(i.to_s.delete('-'))
  files = Dir[project_base_dir?+'animations/*.rb'].map {|entry|
    File.basename(entry)
  }
  files.any? {|filename| filename.include? i }
end

.initialize_the_animated_ascii_componentsObject

#

AsciiParadise.initialize_the_animated_ascii_components

This method will initialize all the animated ASCII components, but only if this has not yet been done.

#


30
31
32
33
34
# File 'lib/ascii_paradise/requires/require_animations_files.rb', line 30

def self.initialize_the_animated_ascii_components
  unless @have_the_animations_files_been_required
    require_animations_files
  end
end

.interactiveObject

#

AsciiParadise.interactive

Use this method if you want to ask interactively what component we should run next.

#


26
27
28
29
30
31
# File 'lib/ascii_paradise/interactive/interactive.rb', line 26

def self.interactive
  @show_this_message_on_exit = 'We will exit now, as requested.'
  register_sigint
  initialize_animated_ascii_components
  ask_the_user_which_component_should_be_run_next
end

.IntercourseObject

#

AsciiParadise.Intercourse

#


32
33
34
# File 'lib/ascii_paradise/animations/intercourse.rb', line 32

def self.Intercourse
  Intercourse
end

.intercourse(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.intercourse

#


39
40
41
# File 'lib/ascii_paradise/animations/intercourse.rb', line 39

def self.intercourse(commandline_arguments = ARGV)
  Intercourse.new(commandline_arguments)
end

.JelloObject

#

AsciiParadise.Jello

#


32
33
34
# File 'lib/ascii_paradise/animations/jello.rb', line 32

def self.Jello
  Jello
end

.jello(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.jello

#


39
40
41
# File 'lib/ascii_paradise/animations/jello.rb', line 39

def self.jello(commandline_arguments = ARGV)
  Jello.new(commandline_arguments)
end

.juggling(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.juggling

#


39
40
41
# File 'lib/ascii_paradise/animations/juggling.rb', line 39

def self.juggling(commandline_arguments = ARGV)
  Juggling.new(commandline_arguments)
end

.JugglingObject

#

AsciiParadise.Juggling

#


32
33
34
# File 'lib/ascii_paradise/animations/juggling.rb', line 32

def self.Juggling
  Juggling
end

.jump_rope(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.jump_rope

#


39
40
41
# File 'lib/ascii_paradise/animations/jump_rope.rb', line 39

def self.jump_rope(commandline_arguments = ARGV)
  JumpRope.new(commandline_arguments)
end

.jumping_pig(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.jumping_pig

#


38
39
40
# File 'lib/ascii_paradise/animations/jumping_pig.rb', line 38

def self.jumping_pig(commandline_arguments = ARGV)
  JumpingPig.new(commandline_arguments)
end

.JumpingPigObject

#

AsciiParadise.JumpingPig

#


31
32
33
# File 'lib/ascii_paradise/animations/jumping_pig.rb', line 31

def self.JumpingPig
  JumpingPig
end

.JumpRopeObject

#

AsciiParadise.JumpRope

#


32
33
34
# File 'lib/ascii_paradise/animations/jump_rope.rb', line 32

def self.JumpRope
  JumpRope
end

.laser_clock(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.last_clock

#


39
40
41
# File 'lib/ascii_paradise/animations/laser_clock.rb', line 39

def self.laser_clock(commandline_arguments = ARGV)
  LaserClock.new(commandline_arguments)
end

.LaserClockObject

#

AsciiParadise.LaserClock

#


32
33
34
# File 'lib/ascii_paradise/animations/laser_clock.rb', line 32

def self.LaserClock
  LaserClock
end

.lightning_bolt(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.lightning_bolt

#


51
52
53
# File 'lib/ascii_paradise/animations/lightning_bolt.rb', line 51

def self.lightning_bolt(commandline_arguments = ARGV)
  LightningBolt.new(commandline_arguments)
end

.LightningBoltObject

#

AsciiParadise.LightningBolt

#


44
45
46
# File 'lib/ascii_paradise/animations/lightning_bolt.rb', line 44

def self.LightningBolt
  LightningBolt
end

.loading_dots(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.loading_dots

#


39
40
41
# File 'lib/ascii_paradise/animations/loading_dots.rb', line 39

def self.loading_dots(commandline_arguments = ARGV)
  LoadingDots.new(commandline_arguments)
end

.LoadingDotsObject

#

AsciiParadise.LoadingDots

#


32
33
34
# File 'lib/ascii_paradise/animations/loading_dots.rb', line 32

def self.LoadingDots
  LoadingDots
end

.lobster(i = ARGV) ⇒ Object

#

AsciiParadise.lobster

#


107
108
109
# File 'lib/ascii_paradise/misc/lobster.rb', line 107

def self.lobster(i = ARGV)
  AsciiParadise::Lobster.new(i)
end

.macarena(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.macarena

#


39
40
41
# File 'lib/ascii_paradise/animations/macarena.rb', line 39

def self.macarena(commandline_arguments = ARGV)
  Macarena.new(commandline_arguments)
end

.MacarenaObject

#

AsciiParadise.Macarena

#


32
33
34
# File 'lib/ascii_paradise/animations/macarena.rb', line 32

def self.Macarena
  Macarena
end

.mediumpurple(i = '') ⇒ Object

#

AsciiParadise.mediumpurple

#


50
51
52
# File 'lib/ascii_paradise/colours/colours.rb', line 50

def self.mediumpurple(i = '')
  Colours.mediumpurple(i)
end
#

AsciiParadise.menu (menu tag)

This method can be used to parse the commandline arguments given to the AsciiParadise project, whenever a user invokes the executable called “ascii_paradise”.

#


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/ascii_paradise/commandline/menu.rb', line 25

def self.menu(
    i = ARGV
  )
  if i.is_a? Array
    i.each {|entry| menu(entry) }
  else
    case i # case tag
    # ===================================================================== #
    # === ascii_paradise --gtk3
    # ===================================================================== #
    when /^-?-?gtk3?$/i,
         /^-?-?gui$/i
      require 'ascii_paradise/gui/gtk3/animated_frame/widget.rb'
      ::AsciiParadise::GUI::Gtk::Widget.run
    # ===================================================================== #
    # === ascii_paradise --gtk2
    # ===================================================================== #
    when /^-?-?gtk2$/i
      require 'ascii_paradise/gui/gtk2/animated_frame/widget.rb'
      ::AsciiParadise::GUI::Gtk::Widget.run
    # ===================================================================== #
    # === ascii_paradise --pretty-flowers
    # ===================================================================== #
    when /^-?-?pretty(-|_)?flowers$/i,
         /^-?-?flowers$/i,
         /^-?-?beautiful(-|_)?flower$/i
      target = AsciiParadise.static_ascii_directory?+'colourful_flowers.ascii'
      if File.exist? target
        e AsciiParadise.colour_parse_this_string(target)        
      else
        e 'No file exists at '+target+'.'
      end
    # ===================================================================== #
    # === ascii_paradise --show_available_ascii_components
    # ===================================================================== #
    when /^-?-?show(-|_)?available(_|-)?ascii(_|-)?components$/i,
         /^-?-?show(-|_)?available$/i
      show_available_ascii_components
    # ===================================================================== #
    # === ascii_paradise --n-components?
    # ===================================================================== #
    when /^-?-?n(_|-)?components\??$/i
      n_components = Dir["#{::AsciiParadise.animations_directory?}*.rb"].size
      e Colours.rev+'The AsciiParadise project has '+
        sfancy(n_components)+' components available.'
    # ===================================================================== #
    # === ascii_paradise --help
    # ===================================================================== #
    when /^-?-?help$/i
      show_help
    # ===================================================================== #
    # === ascii_paradise --demo
    # ===================================================================== #
    when /^-?-?demo$/i,
         /^-?-?run(_|-)?demo$/i
      run_demo
    # ===================================================================== #
    # === ascii_paradise --colour=slateblue
    # ===================================================================== #
    when /^-?-?colour=(.+)/
      this_colour = $1.to_s.dup
      set_use_this_colour(this_colour)
    # ===================================================================== #
    # === ascii_paradise --available_components
    # ===================================================================== #
    when /^-?-?available(_|-)?components$/,
         /^-?-?show(_|-)?components$/ # === aparadise --show-components
      e
      show_available_ascii_components(
        :show_only_ascii_components
      )
      e
    else
      # =================================================================== #
      # Else assume that the user may have possibly wanted to run some
      # animated component of the AsciiParadise project.
      #
      # Invocation example for this:
      #
      #   aparadise Volcano
      #
      # =================================================================== #
      AsciiParadise.run_this_animated_component(i)
    end
  end
end

.mona_lisaObject

#

AsciiParadise.mona_lisa

#


28
29
30
# File 'lib/ascii_paradise/static_ascii/mona_lisa.rb', line 28

def self.mona_lisa
  AsciiParadise::MonaLisa.new
end

.MonaLisaObject

#

AsciiParadise.MonaLisa

#


35
36
37
# File 'lib/ascii_paradise/static_ascii/mona_lisa.rb', line 35

def self.MonaLisa
  AsciiParadise::MonaLisa
end

.moth(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.moth

#


39
40
41
# File 'lib/ascii_paradise/animations/moth.rb', line 39

def self.moth(commandline_arguments = ARGV)
  Moth.new(commandline_arguments)
end

.MothObject

#

AsciiParadise.Moth

#


32
33
34
# File 'lib/ascii_paradise/animations/moth.rb', line 32

def self.Moth
  Moth
end

.n_animated_ascii_componentsObject

#

AsciiParadise.n_animated_ascii_components

This method will return a number, which tells us how many ASCII components are registered in this project.

#


51
52
53
# File 'lib/ascii_paradise/toplevel_methods/available_ascii_components.rb', line 51

def self.n_animated_ascii_components
  ::AsciiParadise.available_ascii_components?.size
end

.n_animated_components?Boolean

#

AsciiParadise.n_animated_components?

This will return how many animated components we have.

#

Returns:

  • (Boolean)


17
18
19
20
21
22
# File 'lib/ascii_paradise/toplevel_methods/n_animated_components.rb', line 17

def self.n_animated_components? # 66
  files = Dir[
    AsciiParadise.animations_subdirectory?+'*.rb'
  ]
  files.size # Return how many entries we have found here.
end

.neverending_staircase(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.neverending_staircase

#


39
40
41
# File 'lib/ascii_paradise/animations/neverending_staircase.rb', line 39

def self.neverending_staircase(commandline_arguments = ARGV)
  NeverendingStaircase.new(commandline_arguments)
end

.NeverendingStaircaseObject

#

AsciiParadise.NeverendingStaircase

#


32
33
34
# File 'lib/ascii_paradise/animations/neverending_staircase.rb', line 32

def self.NeverendingStaircase
  NeverendingStaircase
end

.new(i = ARGV) ⇒ Object

#

AsciiParadise.new

This is a simpler toplevel-instantiation variant.

#


15
16
17
18
19
20
21
22
# File 'lib/ascii_paradise/toplevel_methods/new.rb', line 15

def self.new(i = ARGV)
  i = [i].flatten.compact # Always work on an Array past this point.
  ::AsciiParadise.run_this_animated_component(
    i.map {|entry|
      entry.to_s.delete(':')
    }
  )
end

.one_destroyer(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.one_destroyer

#


39
40
41
# File 'lib/ascii_paradise/animations/one_destroyer.rb', line 39

def self.one_destroyer(commandline_arguments = ARGV)
  OneDestroyer.new(commandline_arguments)
end

.OneDestroyerObject

#

AsciiParadise.OneDestroyer

#


32
33
34
# File 'lib/ascii_paradise/animations/one_destroyer.rb', line 32

def self.OneDestroyer
  OneDestroyer
end

.parachute_jump(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.parachute_jump

#


39
40
41
# File 'lib/ascii_paradise/animations/parachute_jump.rb', line 39

def self.parachute_jump(commandline_arguments = ARGV)
  ParachuteJump.new(commandline_arguments)
end

.ParachuteJumpObject

#

AsciiParadise.ParachuteJump

#


32
33
34
# File 'lib/ascii_paradise/animations/parachute_jump.rb', line 32

def self.ParachuteJump
  ParachuteJump
end

.phone(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.phone

#


40
41
42
# File 'lib/ascii_paradise/animations/phone.rb', line 40

def self.phone(commandline_arguments = ARGV)
  Phone.new(commandline_arguments)
end

.PhoneObject

#

AsciiParadise.Phone

#


33
34
35
# File 'lib/ascii_paradise/animations/phone.rb', line 33

def self.Phone
  Phone
end

.pink_pantherObject

#

AsciiParadise.pink_panther

#


48
49
50
# File 'lib/ascii_paradise/static_ascii/pink_panther.rb', line 48

def self.pink_panther
  AsciiParadise::PinkPanther.run
end

.PinkPantherObject

#

AsciiParadise.PinkPanther

#


55
56
57
# File 'lib/ascii_paradise/static_ascii/pink_panther.rb', line 55

def self.PinkPanther
  AsciiParadise::PinkPanther
end

.planting_a_forest(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.planting_a_forest

#


39
40
41
# File 'lib/ascii_paradise/animations/planting_a_forest.rb', line 39

def self.planting_a_forest(commandline_arguments = ARGV)
  PlantingAForest.new(commandline_arguments)
end

.PlantingAForestObject

#

AsciiParadise.PlantingAForest

#


32
33
34
# File 'lib/ascii_paradise/animations/planting_a_forest.rb', line 32

def self.PlantingAForest
  PlantingAForest
end

.PoniesObject

#

AsciiParadise.Ponies

#


57
58
59
# File 'lib/ascii_paradise/static_ascii/ponies.rb', line 57

def self.Ponies
  AsciiParadise::Ponies
end

.poniesObject

#

AsciiParadise.ponyies

#


50
51
52
# File 'lib/ascii_paradise/static_ascii/ponies.rb', line 50

def self.ponies
  AsciiParadise::Ponies.new
end

.ponysay(i = 'Hello world!') ⇒ Object

#

AsciiParadise.ponysay

The ascii pony will say the given text.

Invocation example:

AsciiParadise.ponysay 'I am a happy pony!'
#


138
139
140
# File 'lib/ascii_paradise/ascii_say/say.rb', line 138

def self.ponysay(i = 'Hello world!')
  say(i, :pony)
end

.progress_barObject

#

AsciiParadise.progress_bar

You can also invoke this method via:

AsciiParadise.progressbar
#


91
92
93
# File 'lib/ascii_paradise/animations/progress_bar.rb', line 91

def self.progress_bar
  ProgressBar.new
end

.ProgressBarObject

#

AsciiParadise.ProgressBar

#


99
100
101
# File 'lib/ascii_paradise/animations/progress_bar.rb', line 99

def self.ProgressBar
  ProgressBar
end

.project_base_dir?Boolean

#

AsciiParadise.project_base_dir?

#

Returns:

  • (Boolean)


19
20
21
# File 'lib/ascii_paradise/project/project.rb', line 19

def self.project_base_dir?
  PROJECT_BASE_DIRECTORY
end

.pull_rope(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.pull_rope

#


39
40
41
# File 'lib/ascii_paradise/animations/pull_rope.rb', line 39

def self.pull_rope(commandline_arguments = ARGV)
  PullRope.new(commandline_arguments)
end

.PullRopeObject

#

AsciiParadise.PullRope

#


32
33
34
# File 'lib/ascii_paradise/animations/pull_rope.rb', line 32

def self.PullRope
  PullRope
end

.raindrop(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.raindrop

#


39
40
41
# File 'lib/ascii_paradise/animations/raindrop.rb', line 39

def self.raindrop(commandline_arguments = ARGV)
  Raindrop.new(commandline_arguments)
end

.RaindropObject

#

AsciiParadise.Raindrop

#


32
33
34
# File 'lib/ascii_paradise/animations/raindrop.rb', line 32

def self.Raindrop
  Raindrop
end

.raining(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.raining

#


39
40
41
# File 'lib/ascii_paradise/animations/raining.rb', line 39

def self.raining(commandline_arguments = ARGV)
  Raining.new(commandline_arguments)
end

.RainingObject

#

AsciiParadise.Raining

#


32
33
34
# File 'lib/ascii_paradise/animations/raining.rb', line 32

def self.Raining
  Raining
end

.ReflectionObject

#

AsciiParadise.Reflection

#


32
33
34
# File 'lib/ascii_paradise/animations/reflection.rb', line 32

def self.Reflection
  Reflection
end

.reflection(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.reflection

#


39
40
41
# File 'lib/ascii_paradise/animations/reflection.rb', line 39

def self.reflection(commandline_arguments = ARGV)
  Reflection.new(commandline_arguments)
end

.register(name, template) ⇒ Object

#

AsciiParadise.register

The second argument to this method is the path to the .ascii file in question, the template that we will use for the speak-bubble.

#


243
244
245
246
247
# File 'lib/ascii_paradise/ascii_say/parse_static_ascii.rb', line 243

def self.register(name, template)
  AsciiParadise.const_set(
    name, AsciiParadise::ParseStaticAscii.new(template)
  )
end

.register_sigint(show_this_message_on_exit = @show_this_message_on_exit) ⇒ Object

#

AsciiParadise.register_sigint

#


19
20
21
22
23
24
25
26
27
28
# File 'lib/ascii_paradise/toplevel_methods/register_sigint.rb', line 19

def self.register_sigint(
    show_this_message_on_exit = @show_this_message_on_exit
  )
  Signal.trap('SIGINT') {
    if show_this_message_on_exit
      e show_this_message_on_exit
    end
    exit
  }
end

.require_animations_filesObject

#

AsciiParadise.require_animations_files

#


39
40
41
42
43
44
45
46
47
48
# File 'lib/ascii_paradise/requires/require_animations_files.rb', line 39

def self.require_animations_files
  # ======================================================================= #
  # Pull in all the subcomponents within the "ascii_paradise/animations/"
  # directory next.
  # ======================================================================= #
  Dir["#{project_base_dir?}animations/*.rb"].each {|file|
    require "ascii_paradise/animations/#{File.basename(file)}"
  }
  @have_the_animations_files_been_required = true
end

.require_sparky_componentsObject

#

AsciiParadise.require_sparky_components

#


12
13
14
# File 'lib/ascii_paradise/requires/require_sparky_components.rb', line 12

def self.require_sparky_components
  require 'ascii_paradise/sparky/sparkline.rb'
end

.require_static_ascii_filesObject

#

AsciiParadise.require_static_ascii_files

#


14
15
16
17
18
19
20
21
22
# File 'lib/ascii_paradise/requires/require_static_ascii_files.rb', line 14

def self.require_static_ascii_files
  # ======================================================================= #
  # Pull in all the subcomponents within the "ascii_paradise/static/"
  # directory next.
  # ======================================================================= #
  Dir["#{AsciiParadise.static_ascii?}*.rb"].each {|file|
    require "ascii_paradise/static_ascii/#{File.basename(file)}"
  }
end

.require_the_toplevel_methodsObject

#

AsciiParadise.require_the_toplevel_methods

#


17
18
19
20
21
# File 'lib/ascii_paradise/requires/require_the_toplevel_methods.rb', line 17

def self.require_the_toplevel_methods
  Dir["#{AsciiParadise::PROJECT_BASE_DIRECTORY}toplevel_methods/*.rb"].each {|this_file|
    require "ascii_paradise/toplevel_methods/#{File.basename(this_file)}"
  }
end

.return_all_animated_ascii_componentsObject

#

AsciiParadise.return_all_animated_ascii_components

This method will return all AsciiParadise components that can be animated.

For now we assume that this will only work for all those components that are a subclass of class AsciiParadise::Animation.

Usage example:

x = AsciiParadise.return_all_animated_ascii_components
#


69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/ascii_paradise/toplevel_methods/available_ascii_components.rb', line 69

def self.return_all_animated_ascii_components
  # ======================================================================= #
  # First obtain the available candidates:
  # ======================================================================= #
  possible_candidates = available_ascii_components?
  # ======================================================================= #
  # Turn these into real constants, via const_get(). In order for this
  # to work, the whole dataset has to be initialized for these individual
  # classes.
  # ======================================================================= #
  possible_candidates.map! {|entry|
    if ::AsciiParadise.const_defined? entry.to_sym
      entry = ::AsciiParadise.const_get(entry)
    end
    entry
  }
  possible_candidates.compact!
  # ======================================================================= #
  # Next select the proper entries that contain the dataset.:
  # ======================================================================= #
  possible_candidates.select! {|entry|
    entry.is_animated?
  }
  # ======================================================================= #
  # Now we have the entries that we want to have, thus we can return them.
  # ======================================================================= #
  return possible_candidates
end

.return_dataset_of_this_animated_ascii_component(i = :volcano, convert_to_camelcase = true) ⇒ Object

#

AsciiParadise.return_dataset_of_this_animated_ascii_component

This method can retrieve the dataset of a given animated ASCII component. This ASCII component must have been registered, though,

The argument to this method should be camelcased, e. g. :RubberDuck rather than :rubber_duck. In order to simplify the use of the API, the user can also send :rubber_duck, though.

A String can also be passed into this method, such as ‘RubberDuck’, but it is recommended to use Symbols, if possible, such as :rubber_duck or :RubberDuck.

Usage examples:

dataset = AsciiParadise.dataset_for(:rubber_duck)
dataset = AsciiParadise.dataset_for(:table_tennis)
dataset = AsciiParadise.dataset_for('TableTennis')
dataset = AsciiParadise.return_dataset_of_this_animated_ascii_component(:volcano)
dataset = AsciiParadise.obtain_dataset_for(1)
#


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/ascii_paradise/toplevel_methods/return_dataset_of_this_animated_ascii_component.rb', line 36

def self.return_dataset_of_this_animated_ascii_component(
    i                    = :volcano, # :rubber_duck,
    convert_to_camelcase = true
  )
  case convert_to_camelcase
  when :do_not_uppercase
    convert_to_camelcase = false
  end
  if i.is_a? Array
    i = i.first
  end
  # ======================================================================= #
  # Initialize the animated ASCII components next:
  # ======================================================================= #
  initialize_the_animated_ascii_components

  i = i.to_s
  # ======================================================================= #
  # Since as of March 2021, when we input a number then we will try
  # to find a matching entry based on a Dir[] action. The idea behind
  # this is to map input such as "1" to a component such as "Turtle".
  # It allows us to find a corresponding animated componented purely
  # based on a number, as input. So 1, 2, 3 and so forth will all
  # become valid arguments for this method.
  # ======================================================================= #
  if i =~ /^\d{1,9}$/
    upper_range = AsciiParadise.n_animated_components? # A number.
    if i.to_i > upper_range
      i = upper_range
    end
    all_files = Dir[project_base_dir?+'animations/*'].select {|entry|
      File.directory?(entry)
    }.map {|inner_entry|
      File.basename(inner_entry)
    }
    i = all_files[i.to_i - 1]
  end
  i = to_camelcase(i) if convert_to_camelcase
  unless AsciiParadise.respond_to? i
    array_available_ascii_components = AsciiParadise.available_ascii_components?
    # ===================================================================== #
    # Try to find a fitting component in this case.
    # ===================================================================== #
    possible_matches = array_available_ascii_components.map {|inner_entry|
      inner_entry.to_s.downcase
    }.select {|entry| entry.include? i.to_s.downcase }
    if !possible_matches.empty?
      # =================================================================== #
      # In this case we have at the least one partial match.
      # =================================================================== #
      i = array_available_ascii_components.select {|entry|
        entry.to_s.downcase.include?(i.to_s.downcase)
      }
      if i.is_a? Array
        i = i.first
      end
    end
  end
  if AsciiParadise.respond_to? i
    instance = AsciiParadise.send(i)
    # ======================================================================= #
    # The dataset that will be returned is an Array.
    # ======================================================================= #
    dataset = instance.new { :do_not_run_yet }.dataset?
    return dataset
  else
    e "Not an animated component (#{i})."
    false
  end
end

.return_what_is_availableObject

#

AsciiParadise.return_what_is_available

#


95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/ascii_paradise/toplevel_methods/show_available_ascii_components.rb', line 95

def self.return_what_is_available
  target = ::AsciiParadise.animations_directory?
  array = []
  # ======================================================================= #
  # Next, obtain all entries residing in the Animations directory.
  # ======================================================================= #
  Dir["#{target}*.rb"].each {|file|
    # ===================================================================== #
    # Next, we modify it a bit, by getting rid of leading "ascii_" and
    # trailing ".rb" part, then capitalizing it:
    # ===================================================================== #
    _ = File.basename(file).sub(/^ascii_/,'').sub(/\.rb$/,'').capitalize.dup
    # ===================================================================== #
    # Followed by camelcasing it:
    # ===================================================================== #
    if _.include? '_'
      _ = _.split('_').map {|e| e.capitalize }.join
    end
    array << _ # And adding it to our Array. \o/
  }
  return array 
end

.riding_a_duck(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.riding_a_duck

#


39
40
41
# File 'lib/ascii_paradise/animations/riding_a_duck.rb', line 39

def self.riding_a_duck(commandline_arguments = ARGV)
  RidingADuck.new(commandline_arguments)
end

.RidingADuckObject

#

AsciiParadise.RidingADuck

#


32
33
34
# File 'lib/ascii_paradise/animations/riding_a_duck.rb', line 32

def self.RidingADuck
  RidingADuck
end

.rotating_cube(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.rotating_cube

#


39
40
41
# File 'lib/ascii_paradise/animations/rotating_cube.rb', line 39

def self.rotating_cube(commandline_arguments = ARGV)
  RotatingCube.new(commandline_arguments)
end

.rotating_dna(runmode = :dna) ⇒ Object

#

AsciiParadise.rotating_dna

#


180
181
182
# File 'lib/ascii_paradise/animations/rotating_dna.rb', line 180

def self.rotating_dna(runmode = :dna)
  AsciiParadise::RotatingDNA[runmode]
end

.rotating_globe(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.rotating_globe

#


38
39
40
# File 'lib/ascii_paradise/animations/rotating_globe.rb', line 38

def self.rotating_globe(commandline_arguments = ARGV)
  RotatingGlobe.new(commandline_arguments)
end

.rotating_slashObject

#

AsciiParadise.rotating_slash

#


99
100
101
# File 'lib/ascii_paradise/animations/rotating_slash.rb', line 99

def self.rotating_slash
  AsciiParadise::RotatingSlash.new
end

.RotatingCubeObject

#

AsciiParadise.RotatingCube

#


32
33
34
# File 'lib/ascii_paradise/animations/rotating_cube.rb', line 32

def self.RotatingCube
  RotatingCube
end

.RotatingDnaObject

#

AsciiParadise.RotatingDna

#


187
188
189
# File 'lib/ascii_paradise/animations/rotating_dna.rb', line 187

def self.RotatingDna
  AsciiParadise::RotatingDNA
end

.RotatingGlobeObject

#

AsciiParadise.RotatingGlobe

#


31
32
33
# File 'lib/ascii_paradise/animations/rotating_globe.rb', line 31

def self.RotatingGlobe
  RotatingGlobe
end

.RotatingSlashObject

#

AsciiParadise.RotatingSlash

#


106
107
108
# File 'lib/ascii_paradise/animations/rotating_slash.rb', line 106

def self.RotatingSlash
  AsciiParadise::RotatingSlash
end

.rubber_duck(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.rubber_duck

#


39
40
41
# File 'lib/ascii_paradise/animations/rubber_duck.rb', line 39

def self.rubber_duck(commandline_arguments = ARGV)
  RubberDuck.new(commandline_arguments)
end

.RubberDuckObject

#

AsciiParadise.RubberDuck

#


32
33
34
# File 'lib/ascii_paradise/animations/rubber_duck.rb', line 32

def self.RubberDuck
  RubberDuck
end

.run_class_based_on_this_filename(i) ⇒ Object

#

AsciiParadise.run_class_based_on_this_filename

This method should only be called after a prior call to AsciiParadise.include_this_file?().

#


17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ascii_paradise/toplevel_methods/run_class_based_on_this_filename.rb', line 17

def self.run_class_based_on_this_filename(i)
  if i.is_a? Array
    i = i.first
  end
  # ======================================================================= #
  # First, obtain the proper filename.
  # ======================================================================= #
  i = File.basename(i.to_s.delete('-'))
  i.sub!(/#{File.extname(i)}$/,'')
  run_this_animated_component(i)
end

.run_random_animationObject

#

AsciiParadise.run_random_animation

This method can be used to run a random animation.

#


132
133
134
135
# File 'lib/ascii_paradise/toplevel_methods/run_this_animated_component.rb', line 132

def self.run_random_animation
  _ = available_ascii_components?.sample
  run_this_animated_component(_)
end

.run_this_animated_component(i = :default) ⇒ Object

#

AsciiParadise.run_this_animated_component

This toplevel method can be used to run an animated component of the AsciiParadise project. The main purpose is, primarily, to allow this from the commandline directly, so that it can be used from the file residing at bin/ascii_paradise directly.

The API use may be like this:

AsciiParadise.run_this_animated_component '--endless_runner'
AsciiParadise.run_this_animated_component '--chopper'

Note that you can also obtain individual frames, like this:

AsciiParadise.run(:spider) { :frame5 }
AsciiParadise.run(:spider) { 5 }

This component will be returned.

#


35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/ascii_paradise/toplevel_methods/run_this_animated_component.rb', line 35

def self.run_this_animated_component(
    i = :default
  )
  if i.is_a? Array
    i = i.join(' ').strip # Aggregate the Array into a String.
  end
  case i
  when :default
    i = 'endless_runner' # This is the default value.
  end
  require 'abbrev'
  array_available_constants = available_ascii_components?
  this_constant = i.to_s.delete('-') # This will now be something like "endless_runner".
  case this_constant # Use some popular aliases/shortcuts.
  when 'tennis'
    this_constant = 'table_tennis'
  end
  if this_constant.include? '_' # This requires a camelcase-operation!
    this_constant = to_camelcase(this_constant)
  end
  unless array_available_constants.include? this_constant
    # ===================================================================== #
    # In this case, the input was not found, so we will try to
    # abbrev-find something more useful.
    # ===================================================================== #
    flattened = Abbrev.abbrev(array_available_constants).flatten
    alternatives = Hash[*flattened.sort]
    if alternatives.has_key? this_constant
      # =================================================================== #
      # Ok, the hash includes that key, so find the real constant next.
      # =================================================================== #
      this_constant = alternatives[this_constant]
    end
  end
  if this_constant.include? '=' # In this case, assume input such as "colour=slateblue"
    # ======================================================================= #
    # Pass through in this case. Not sure if this is still in use or not,
    # though.
    # ======================================================================= #
  else
    # ======================================================================= #
    # First we must check if the input is only-numbers. In this case we
    # will use Dir[] to determine which component to run.
    # ======================================================================= #
    this_constant = this_constant.to_s
    if this_constant =~ /^\d{1,5}$/
      # project_base_directory? refers to e. g. "/usr/lib/ruby/site_ruby/3.1.0/ascii_paradise/"
      target = project_base_directory?+'animations/*.rb'
      all_files = Dir[target].map {|entry|
        entry = File.basename(entry).delete_suffix('.rb')
        entry
      }
      this_constant = all_files[i.to_i - 1]
    end
    # ======================================================================= #
    # In a constant, the first character is ALWAYS upcased. The following
    # line ensures this to be the case.
    # ======================================================================= #
    this_constant = this_constant.dup if this_constant.frozen?
    this_constant[0,1] = this_constant[0,1].upcase
    # ======================================================================= #
    # Ensure that the animated ASCII components are initialized next.
    # ======================================================================= #
    initialize_the_animated_ascii_components
    this_constant = AsciiParadise.to_camelcase(this_constant)
    if ::AsciiParadise.const_defined? this_constant
      yielded = nil
      if block_given?
        yielded = yield
      end
      if yielded
        if yielded.is_a? Symbol
          # Assume a symbol such as: frame5
          if yielded.to_s.start_with?('frame')
            yielded = yielded.to_s.sub(/^frame/,'').to_i
          end
        end
        if yielded.is_a? Numeric
          _ = AsciiParadise.return_dataset_of_this_animated_ascii_component(this_constant)
          return _[yielded - 1]
        end
      end
      case this_constant
      when 'Heart'
        ::AsciiParadise.ascii_heart
      else
        ::AsciiParadise.send(this_constant).animate # We will make use of the .animate method.
      end
    end
  end
end

.running_man(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.running_man

#


39
40
41
# File 'lib/ascii_paradise/animations/running_man.rb', line 39

def self.running_man(commandline_arguments = ARGV)
  RunningMan.new(commandline_arguments)
end

.RunningManObject

#

AsciiParadise.RunningMan

#


32
33
34
# File 'lib/ascii_paradise/animations/running_man.rb', line 32

def self.RunningMan
  RunningMan
end

.sailing_boat(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.sailing_boat

#


39
40
41
# File 'lib/ascii_paradise/animations/sailing_boat.rb', line 39

def self.sailing_boat(commandline_arguments = ARGV)
  SailingBoat.new(commandline_arguments)
end

.SailingBoatObject

#

AsciiParadise.SailingBoat

#


32
33
34
# File 'lib/ascii_paradise/animations/sailing_boat.rb', line 32

def self.SailingBoat
  SailingBoat
end

.sand_clock(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.sand_clock

#


39
40
41
# File 'lib/ascii_paradise/animations/sand_clock.rb', line 39

def self.sand_clock(commandline_arguments = ARGV)
  SandClock.new(commandline_arguments)
end

.SandClockObject

#

AsciiParadise.SandClock

#


32
33
34
# File 'lib/ascii_paradise/animations/sand_clock.rb', line 32

def self.SandClock
  SandClock
end

.seductive_ladyObject

#

AsciiParadise.seductive_lady

#


37
38
39
# File 'lib/ascii_paradise/static_ascii/seductive_lady.rb', line 37

def self.seductive_lady
  AsciiParadise::SeductiveLady.new
end

.SeductiveLadyObject

#

AsciiParadise.SeductiveLady

#


44
45
46
# File 'lib/ascii_paradise/static_ascii/seductive_lady.rb', line 44

def self.SeductiveLady
  AsciiParadise::SeductiveLady
end

.SeesawObject

#

AsciiParadise.Seesaw

#


32
33
34
# File 'lib/ascii_paradise/animations/seesaw.rb', line 32

def self.Seesaw
  Seesaw
end

.seesaw(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.seesaw

#


39
40
41
# File 'lib/ascii_paradise/animations/seesaw.rb', line 39

def self.seesaw(commandline_arguments = ARGV)
  Seesaw.new(commandline_arguments)
end

.set_colour(i = nil) ⇒ Object

#

AsciiParadise.set_colour

#


36
37
38
# File 'lib/ascii_paradise/colours/colours.rb', line 36

def self.set_colour(i = nil)
  @colour = i
end

.sfancy(i) ⇒ Object

#

AsciiParadise.sfancy

#


71
72
73
# File 'lib/ascii_paradise/colours/colours.rb', line 71

def self.sfancy(i)
  Colours.sfancy(i)
end

.sfile(i) ⇒ Object

#

AsciiParadise.sfile

#


64
65
66
# File 'lib/ascii_paradise/colours/colours.rb', line 64

def self.sfile(i)
  Colours.sfile(i)
end

.shooting_range(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.shooting_range

#


39
40
41
# File 'lib/ascii_paradise/animations/shooting_range.rb', line 39

def self.shooting_range(commandline_arguments = ARGV)
  ShootingRange.new(commandline_arguments)
end

.ShootingRangeObject

#

AsciiParadise.ShootingRange

#


32
33
34
# File 'lib/ascii_paradise/animations/shooting_range.rb', line 32

def self.ShootingRange
  ShootingRange
end

.shotgun(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.shotgun

#


39
40
41
# File 'lib/ascii_paradise/animations/shotgun.rb', line 39

def self.shotgun(commandline_arguments = ARGV)
  Shotgun.new(commandline_arguments)
end

.ShotgunObject

#

AsciiParadise.Shotgun

#


32
33
34
# File 'lib/ascii_paradise/animations/shotgun.rb', line 32

def self.Shotgun
  Shotgun
end

.show_available_ascii_components(display_mode = :everything) ⇒ Object

#

AsciiParadise.show_available_ascii_components

This method will show the available ASCII classes.

Since as of March 2017, this class accepts an optional argument, which should be a Symbol. The default Symbol is :everything which means that we will display everything, including the LINKS.md file - on my home system at least.

If the argument is :show_only_ascii_components then we will only show the ASCII components of the project.

To invoke this, do:

aparadise --help
aparadise --show-available
#


33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/ascii_paradise/toplevel_methods/show_available_ascii_components.rb', line 33

def self.show_available_ascii_components(
    display_mode = :everything
  )
  target = ::AsciiParadise.animations_directory?
  if display_mode == :everything
    e 'The following classes are part of this project:'
    e
  end
  array = []
  # ======================================================================= #
  # Next, obtain all entries residing in the Animations directory.
  # ======================================================================= #
  Dir["#{target}*.rb"].each {|file|
    # ===================================================================== #
    # Next, we modify it a bit, by getting rid of leading "ascii_" and
    # trailing ".rb" part, then capitalizing it:
    # ===================================================================== #
    _ = File.basename(file).sub(/^ascii_/,'').sub(/\.rb$/,'').capitalize.dup
    # ===================================================================== #
    # Followed by camelcasing it:
    # ===================================================================== #
    if _.include? '_'
      _ = _.split('_').map {|e| e.capitalize }.join
    end
    array << _ # And adding it to our Array. \o/
  }
  # ======================================================================= #
  # Next, display that array in a sorted manner.
  # ======================================================================= #
  array.sort.each_with_index {|entry, _index|
    _index += 1
    case display_mode
    when :everything, :default
      e '  '+sfancy(entry)
    when :show_only_ascii_components
      e simp(_index.to_s.rjust(5))+') '+sfancy(entry)
    end
  }
  case display_mode
  # ======================================================================= #
  # === :everything
  # ======================================================================= #
  when :everything
    e
    # ===================================================================== #
    # === Next, display the LINKS.md file if it is available.
    #
    # This is the primary use case for :everything.
    # ===================================================================== #
    _ = "#{HOME_DIRECTORY_OF_THE_USER_X}DATA/PROGRAMMING_LANGUAGES/RUBY/src/ascii_paradise/doc/LINKS.md"
    if File.exist? _
      e 'Additionally, these links are available:'; e
      File.read(_).split(N).select {|entry| entry.start_with? '  '}.each {|file|
        e '  '+simp(file)
      }; e
    end
  end
end

.show_helpObject

#

AsciiParadise.show_help

This method can be used to show the available help options in general.

It is a class-method primarily so that we can display the help options without having to instantiate a new class.

An invocation example for the method follows:

asciispider --help
#


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/ascii_paradise/commandline/help.rb', line 25

def self.show_help
  e 'These options are available:'
  e
  array = [] # Store it in an Array, primarily so that we can run .sort on it.
  array << '  --run-n-times=()             # run n times'
  array << '  --no-clear                   # do not invoke "clear"; this '\
           'may be helpful for debugging'
  array << '  --wait-for-keypress          # wait for keypress events'
  array << '  --colour=green               # use a specific colour, in this example green'
  array << '  --colour=random-colour       # this is equivalent to --random-colour'
  array << '  --colourspray                # use a random colour during each (full) '\
           'iteration'
  array << '  --rainbow-line               # this option will colourize every '\
           'individual cell of a given frame'
  array << '  --disco-inferno              # change the colour during every iteration'
  array << '  --half-colour                # use two random colours, one '\
           'for the upper area, another for the lower area '
  array << '  --numbers                    # like --full-debug but also uses red '\
           '"frame numbers"'
  array << '  --random-colour              # use a random colour (useful if '\
           'you do not want to decide on any specific colour)'
  array << '  --overview                   # show the available components '\
           '(most of them at least)'
  array << '  --n_components?              # show how many components are '\
           'available (a number)'
  array << '  --interactive                # enter the interactive part '\
           'of AsciiParadise'
  array << '  --random                     # run a random component of '\
           'the AsciiParadise project'
  array << '  --show-frame=33              # show a specific frame, '\
           'in this case, frame 33'
  array << '  --framerate                  # query, in seconds, the delay '\
           'before the next frame is shown'
  array << '  --delay=2 (Float or Integer) # set the delay to 2 '\
           'seconds, in this case; use any number as input'
  array << '  --random                     # animate a random component'
  array.sort.each {|entry| e entry }
  # ======================================================================= #
  # Check if Konsole is available, as part of the Colours namespace.
  # ======================================================================= #
  unless Object.const_defined? :Colours
    e; e 'Note that you do not appear to have Colours available.'
       e 'This means that we will use normal ansicolours instead.'
  end
  e
end

.show_interactive_helpObject

#

AsciiParadise.show_interactive_help (help tag)

This method will allow the user to select the relevant component to run.

#


39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/ascii_paradise/interactive/interactive.rb', line 39

def self.show_interactive_help
  e 'These interactive components are available:'
  e
  # ======================================================================= #
  # === Get a handle on all the ASCII components of this project next
  #
  # This requires that we initiate these components first when running
  # this interactive-component, which has been done before via
  # initialize_animated_ascii_components().
  # ======================================================================= #
  components = return_all_animated_ascii_components
  components.each_with_index {|entry, index|
    index += 1
    e index.to_s.rjust(4)+' '+Colours.simp(entry)
  }
  e
  e 'Please input the positional number only, such as "50", without '\
    'the "" quotes.'
  e
  e 'If you wish to use colours-gem, simply input the colour, '\
    'then press enter.'
  e 'All components from that point onwards will use this colour.'
  e 'Use "clear" to clear it again.'
  # e 'You can input either the full name, a partial name, or the '\
  #   'positional number.'
  # e
  # e 'So for instance, if you have this line here "50 AsciiParadise::Worm", '\
  #   'then'
  # e 'you can invoke this either by typing 50, by typing worm or Worm '\
  #   'but also'
  # e 'by typing AsciiParadise::Worm or AsciiParadise.Worm.'
end

.sierpinski_triangle(size = 80) ⇒ Object

#

AsciiParadise.sierpinski_triangle

#


87
88
89
# File 'lib/ascii_paradise/static_ascii/sierpinksi_triangle.rb', line 87

def self.sierpinski_triangle(size = 80)
  AsciiParadise::SierpinksiTriangle.new(size)
end

.SierpinskiTriangleObject

#

AsciiParadise.SierpinskiTriangle

#


94
95
96
# File 'lib/ascii_paradise/static_ascii/sierpinksi_triangle.rb', line 94

def self.SierpinskiTriangle
  AsciiParadise::SierpinksiTriangle
end

.silent_city(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.silent_city

#


39
40
41
# File 'lib/ascii_paradise/animations/silent_city.rb', line 39

def self.silent_city(commandline_arguments = ARGV)
  SilentCity.new(commandline_arguments)
end

.SilentCityObject

#

AsciiParadise.SilentCity

#


32
33
34
# File 'lib/ascii_paradise/animations/silent_city.rb', line 32

def self.SilentCity
  SilentCity
end

.simp(i) ⇒ Object

#

AsciiParadise.simp

#


57
58
59
# File 'lib/ascii_paradise/colours/colours.rb', line 57

def self.simp(i)
  Colours.simp(i)
end

.soccer_in_front_of_a_house(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.SoccerInFrontOfAHouse

#


40
41
42
# File 'lib/ascii_paradise/animations/soccer_in_front_of_a_house.rb', line 40

def self.soccer_in_front_of_a_house(commandline_arguments = ARGV)
  SoccerInFrontOfAHouse.new(commandline_arguments)
end

.soccer_twins(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.soccer_twins

#


39
40
41
# File 'lib/ascii_paradise/animations/soccer_twins.rb', line 39

def self.soccer_twins(commandline_arguments = ARGV)
  SoccerTwins.new(commandline_arguments)
end

.SoccerInFrontOfAHouseObject

#

AsciiParadise.SoccerInFrontOfAHouse

#


33
34
35
# File 'lib/ascii_paradise/animations/soccer_in_front_of_a_house.rb', line 33

def self.SoccerInFrontOfAHouse
  SoccerInFrontOfAHouse
end

.SoccerTwinsObject

#

AsciiParadise.SoccerTwins

#


32
33
34
# File 'lib/ascii_paradise/animations/soccer_twins.rb', line 32

def self.SoccerTwins
  SoccerTwins
end

.sort_files(sort_these_files) ⇒ Object

#

AsciiParadise.sort_files

This module-method will keep the files stored in the animations/ subdirectory properly sorted, from 01 etc.. to 100 and so on.

It will use a regex in order to achieve this.

#


18
19
20
21
22
23
24
25
# File 'lib/ascii_paradise/toplevel_methods/sort_files.rb', line 18

def self.sort_files(sort_these_files)
  sort_these_files.sort_by! {|entry|
    regex = /\/.+_(\d+).ascii$/ # See: http://rubular.com/r/9UfgCczgPi
    entry =~ regex
    number_value = $1.to_s.dup
    number_value.to_i
  }
end

.sparky(numbers, &block) ⇒ String

#

AsciiParadise.sparky

This method will return a UTF-8 “sparky” line.

Invocation example:

array = [3, 33]
AsciiParadise.sparky(array)

Next, let’s show an example with a block passed to the method:

Let’s say you have your list of open and closed issues, but you want to format it so the open ones are red and the closed ones are green, so you can quickly see how you are doing. Let’s further suppose you use a gem that adds a #color method to String for ANSI coloring.

line = AsciiParadise.sparky(list) { |tick, count, index|
  if index == 0
    tick.color(:red)
  else
    tick.color(:green)
  end
}
line
#

Parameters:

  • numbers (Array<String, Fixnum, Float>)

    the numbers to be rendered

  • &block (Proc)

    optional, can be used to format the rendered string

Returns:

  • (String)


152
153
154
155
156
157
158
159
160
161
# File 'lib/ascii_paradise/sparky/sparkline.rb', line 152

def self.sparky(numbers, &block)
  new_sparky_instance = Sparky.new(numbers)
  # ======================================================================= #
  # Handle blocks given to this method.
  # ======================================================================= #
  if block
    new_sparky_instance.format(&block)
  end
  new_sparky_instance.to_s
end

.SpiderObject

#

AsciiParadise.Spider

#


32
33
34
# File 'lib/ascii_paradise/animations/spider.rb', line 32

def self.Spider
  Spider
end

.spider(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.spider

#


39
40
41
# File 'lib/ascii_paradise/animations/spider.rb', line 39

def self.spider(commandline_arguments = ARGV)
  Spider.new(commandline_arguments)
end

.star_trek(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.star_trek

#


40
41
42
# File 'lib/ascii_paradise/animations/star_trek.rb', line 40

def self.star_trek(commandline_arguments = ARGV)
  StarTrek.new(commandline_arguments)
end

.StarTrekObject

#

AsciiParadise.StarTrek

#


33
34
35
# File 'lib/ascii_paradise/animations/star_trek.rb', line 33

def self.StarTrek
  StarTrek
end

.static_ascii?Boolean

#

AsciiParadise.static_ascii?

This method may resolve to a path such as:

"/Programs/Ruby/2.6.3/lib/ruby/site_ruby/2.6.0/ascii_paradise/static_ascii/"
#

Returns:

  • (Boolean)


54
55
56
# File 'lib/ascii_paradise/project/project.rb', line 54

def self.static_ascii?
  "#{::AsciiParadise.project_base_directory?}static_ascii/"
end

.static_pacmanObject

#

AsciiParadise.static_pacman

#


62
63
64
# File 'lib/ascii_paradise/static_ascii/static_pacman.rb', line 62

def self.static_pacman
  AsciiParadise::StaticPacman.new
end

.StaticPacmanObject

#

AsciiParadise.StaticPacman

#


55
56
57
# File 'lib/ascii_paradise/static_ascii/static_pacman.rb', line 55

def self.StaticPacman
  AsciiParadise::StaticPacman
end

.station_traffic(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.station_traffic

#


39
40
41
# File 'lib/ascii_paradise/animations/station_traffic.rb', line 39

def self.station_traffic(commandline_arguments = ARGV)
  StationTraffic.new(commandline_arguments)
end

.StationTrafficObject

#

AsciiParadise.StationTraffic

#


32
33
34
# File 'lib/ascii_paradise/animations/station_traffic.rb', line 32

def self.StationTraffic
  StationTraffic
end

.SteamerObject

#

AsciiParadise.Steamer

#


32
33
34
# File 'lib/ascii_paradise/animations/steamer.rb', line 32

def self.Steamer
  Steamer
end

.steamer(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.steamer

#


39
40
41
# File 'lib/ascii_paradise/animations/steamer.rb', line 39

def self.steamer(commandline_arguments = ARGV)
  Steamer.new(commandline_arguments)
end

.stepper_lepper(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.stepper_lepper

#


40
41
42
# File 'lib/ascii_paradise/animations/stepper_lepper.rb', line 40

def self.stepper_lepper(commandline_arguments = ARGV)
  StepperLepper.new(commandline_arguments)
end

.StepperLepperObject

#

AsciiParadise.StepperLepper

#


33
34
35
# File 'lib/ascii_paradise/animations/stepper_lepper.rb', line 33

def self.StepperLepper
  StepperLepper
end

.swarn(i) ⇒ Object

#

AsciiParadise.swarn

#


78
79
80
# File 'lib/ascii_paradise/colours/colours.rb', line 78

def self.swarn(i)
  Colours.swarn(i)
end

.swimming_lane(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.swimming_lane

#


39
40
41
# File 'lib/ascii_paradise/animations/swimming_lane.rb', line 39

def self.swimming_lane(commandline_arguments = ARGV)
  SwimmingLane.new(commandline_arguments)
end

.SwimmingLaneObject

#

AsciiParadise.SwimmingLane

#


32
33
34
# File 'lib/ascii_paradise/animations/swimming_lane.rb', line 32

def self.SwimmingLane
  SwimmingLane
end

.table(*dataset) ⇒ Object

#

AsciiParadise.table

This method will show a simple ASCII Table of the given input.

The input to this method should be an Array or just several strings.

Usage example:

AsciiParadise.table 'hello','world','john', 'doe'
#


21
22
23
24
25
26
27
28
29
30
# File 'lib/ascii_paradise/table/table.rb', line 21

def self.table(*dataset)
  chunk = dataset.each_slice(2).to_a
  line = '# =========================================================== #'
  e line
  chunk.each {|array|
    _ = array[0].rjust(28)+' | '+array[1].ljust(28)
    e '# '+_+' #'
  }
  e line
end

.table_flipObject

#

AsciiParadise.table_flip

#


89
90
91
# File 'lib/ascii_paradise/curses/table_flip.rb', line 89

def self.table_flip
  AsciiParadise::TableFlip.run
end

.table_tennis(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.table_tennis

#


38
39
40
# File 'lib/ascii_paradise/animations/table_tennis.rb', line 38

def self.table_tennis(commandline_arguments = ARGV)
  TableTennis.new(commandline_arguments)
end

.TableFlipObject

#

AsciiParadise.TableFlip

#


96
97
98
# File 'lib/ascii_paradise/curses/table_flip.rb', line 96

def self.TableFlip
  AsciiParadise::TableFlip
end

.TableTennisObject

#

AsciiParadise.TableTennis

#


31
32
33
# File 'lib/ascii_paradise/animations/table_tennis.rb', line 31

def self.TableTennis
  TableTennis
end

.tears_of_ice(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.tears_of_ice

#


40
41
42
# File 'lib/ascii_paradise/animations/tears_of_ice.rb', line 40

def self.tears_of_ice(commandline_arguments = ARGV)
  TearsOfIce.new(commandline_arguments)
end

.TearsOfIceObject

#

AsciiParadise.TearsOfIce

#


33
34
35
# File 'lib/ascii_paradise/animations/tears_of_ice.rb', line 33

def self.TearsOfIce
  TearsOfIce
end

.template_directory?Boolean

#

AsciiParadise.template_directory?

Where we store the .txt files that can be used for cartoon-like speaking.

#

Returns:

  • (Boolean)


31
32
33
# File 'lib/ascii_paradise/project/project.rb', line 31

def self.template_directory?
  "#{::AsciiParadise.project_base_directory?}ascii_say/"
end

.tetris(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.tetris

#


39
40
41
# File 'lib/ascii_paradise/animations/tetris.rb', line 39

def self.tetris(commandline_arguments = ARGV)
  Tetris.new(commandline_arguments)
end

.TetrisObject

#

AsciiParadise.Tetris

#


32
33
34
# File 'lib/ascii_paradise/animations/tetris.rb', line 32

def self.Tetris
  Tetris
end

.thread_and_ball(commandline_arguments) ⇒ Object

#

AsciiParadise.thread_and_ball

#


39
40
41
# File 'lib/ascii_paradise/animations/thread_and_ball.rb', line 39

def self.thread_and_ball(commandline_arguments)
  ThreadAndBall.new(commandline_arguments)
end

.ThreadAndBallObject

#

AsciiParadise.ThreadAndBall

#


32
33
34
# File 'lib/ascii_paradise/animations/thread_and_ball.rb', line 32

def self.ThreadAndBall
  ThreadAndBall
end

.to_camelcase(i) ⇒ Object

#

AsciiParadise.to_camelcase

This will camelcase the given input, from ‘rubber_duck’ to ‘RubberDuck’.

#


14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ascii_paradise/toplevel_methods/to_camelcase.rb', line 14

def self.to_camelcase(i)
  if i.is_a? Array
    i = i.first
  end
  if i
    if i.include? '_'
      return i.to_s.split('_').map { |_| _.capitalize }.join
    else
      i = i.dup if i.frozen?
      i[0] = i[0].upcase
    end
  end
  i
end

.TrampolineObject

#

AsciiParadise.Trampoline

#


32
33
34
# File 'lib/ascii_paradise/animations/trampoline.rb', line 32

def self.Trampoline
  Trampoline
end

.trampoline(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.trampoline

#


39
40
41
# File 'lib/ascii_paradise/animations/trampoline.rb', line 39

def self.trampoline(commandline_arguments = ARGV)
  Trampoline.new(commandline_arguments)
end

.TurtleObject

#

AsciiParadise.Turtle

#


31
32
33
# File 'lib/ascii_paradise/animations/turtle.rb', line 31

def self.Turtle
  Turtle
end

.turtle(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.turtle

#


38
39
40
# File 'lib/ascii_paradise/animations/turtle.rb', line 38

def self.turtle(commandline_arguments = ARGV)
  Turtle.new(commandline_arguments)
end

.volcano(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.volcano

#


38
39
40
# File 'lib/ascii_paradise/animations/volcano.rb', line 38

def self.volcano(commandline_arguments = ARGV)
  Volcano.new(commandline_arguments)
end

.VolcanoObject

#

AsciiParadise.Volcano

#


31
32
33
# File 'lib/ascii_paradise/animations/volcano.rb', line 31

def self.Volcano
  Volcano
end

.WhipObject

#

AsciiParadise.Whip

#


31
32
33
# File 'lib/ascii_paradise/animations/whip.rb', line 31

def self.Whip
  Whip
end

.whip(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.whip

#


38
39
40
# File 'lib/ascii_paradise/animations/whip.rb', line 38

def self.whip(commandline_arguments = ARGV)
  Whip.new(commandline_arguments)
end

.WorkerObject

#

AsciiParadise.Worker

#


32
33
34
# File 'lib/ascii_paradise/animations/worker.rb', line 32

def self.Worker
  Worker
end

.worker(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.worker

#


39
40
41
# File 'lib/ascii_paradise/animations/worker.rb', line 39

def self.worker(commandline_arguments = ARGV)
  Worker.new(commandline_arguments)
end

.WormObject

#

AsciiParadise.Worm

#


32
33
34
# File 'lib/ascii_paradise/animations/worm.rb', line 32

def self.Worm
  Worm
end

.worm(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.worm

#


39
40
41
# File 'lib/ascii_paradise/animations/worm.rb', line 39

def self.worm(commandline_arguments = ARGV)
  Worm.new(commandline_arguments)
end

.wrap_at(this_string, my_limit = N_CHARACTERS_PER_LINE, add_newline = true, add_padding = nil) ⇒ Object

#

AsciiParadise.wrap_at (Begrenzung tag, limit tag, boundary tag)

Wraps at a specified position.

Specific examples:

puts "abc abc abdc abc abc abc abc abc abc abc abcdef abc abc abc abc abc abc abc abc abc ".wrap_at(20)
puts AsciiParadise.wrap_at(("x"*200), 30)
("x"*200).wrap_at(30,true,5)
#


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/ascii_paradise/toplevel_methods/wrap_at.rb', line 28

def self.wrap_at(
    this_string, # <- This must be the input-String.
    my_limit    = N_CHARACTERS_PER_LINE,
    add_newline = true,
    add_padding = nil
  )
  case my_limit
  when :default
    my_limit = N_CHARACTERS_PER_LINE
  end
  begin
    add_padding = add_padding.to_i unless add_padding.nil?
    if add_newline
      _ = "\\1\\3\n" # newline at end
      unless add_padding.nil?
        _ = _.linsert(' ' * add_padding)
      end
      return this_string.gsub(
        /(.{1,#{my_limit}})( +|$)\n?|(.{#{my_limit}})/,_
      )
    else
      _ = "\\1\\3"
      unless add_padding.nil?
        _ = _.linsert(' ' * add_padding)
      end
      return this_string.gsub(
        /(.{1,#{my_limit}})( +|$)\n?|(.{#{my_limit}})/,
        _
      ) # No newline at the end.
    end
  rescue Exception => error
    puts error
  end
end

.wrist_watch(commandline_arguments = ARGV) ⇒ Object

#

AsciiParadise.wrist_watch

#


38
39
40
# File 'lib/ascii_paradise/animations/wrist_watch.rb', line 38

def self.wrist_watch(commandline_arguments = ARGV)
  WristWatch.new(commandline_arguments)
end

.WristWatchObject

#

AsciiParadise.WristWatch

#


31
32
33
# File 'lib/ascii_paradise/animations/wrist_watch.rb', line 31

def self.WristWatch
  WristWatch
end

Instance Method Details

#return_checkmark_symbolObject

#

return_checkmark_symbol

#


166
167
168
# File 'lib/ascii_paradise/sparky/sparkline.rb', line 166

def return_checkmark_symbol
  CHECKMARK_SYMBOL
end