Skip to content

Instantly share code, notes, and snippets.

@jewel12
Created August 23, 2014 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jewel12/28fbad2922570d4dc7a9 to your computer and use it in GitHub Desktop.
Save jewel12/28fbad2922570d4dc7a9 to your computer and use it in GitHub Desktop.
Pretty(Cure)Print
# -*- coding: utf-8 -*-
require 'pp'
require 'rubicure'
module PrettyCurePrinter
# 設定ファイルに書いた方がいい
# precure_name => [foreground, background]
PRECURE_COLOR_SETTING = {
'キュアブラック' => [:white, :black],
'キュアホワイト' => [:black, :white],
'シャイニールミナス' => [:red, :yellow],
'キュアブルーム' => [:red, :yellow],
'キュアイーグレット' => [:black, :white],
'キュアドリーム' => [:white, :magenta],
'キュアルージュ' => [:white, :red],
'キュアレモネード' => [:white, :yellow],
'キュアミント' => [:white, :green],
'キュアアクア' => [:white, :blue],
'ミルキィローズ' => [:cyan, :magenta],
'キュアピーチ' => [:yellow, :magenta],
'キュアベリー' => [:magenta, :blue],
'キュアパイン' => [:white, :yellow],
'キュアパッション' => [:black, :red],
'キュアブロッサム' => [:white, :magenta],
'キュアマリン' => [:white, :cyan],
'キュアサンシャイン' => [:white, :yellow],
'キュアムーンライト' => [:magenta, :cyan],
'キュアメロディ' => [:white, :magenta],
'キュアリズム' => [:yellow, :white],
'キュアビート' => [:black, :blue],
'キュアミューズ' => [:white, :yellow],
'キュアハッピー' => [:white, :magenta],
'キュアサニー' => [:yellow, :red],
'キュアピース' => [:white, :yellow],
'キュアマーチ' => [:white, :green],
'キュアビューティ' => [:black, :blue],
'キュアハート' => [:white, :magenta],
'キュアダイヤモンド' => [:white, :blue],
'キュアロゼッタ' => [:white, :yellow],
'キュアソード' => [:white, :cyan],
'キュアエース' => [:white, :red],
'キュアラブリー' => [:white, :magenta],
'キュアプリンセス' => [:black, :cyan],
'キュアハニー' => [:white, :yellow],
'キュアフォーチュン' => [:black, :cyan]
}
COLORS = {
black: 0,
red: 1,
green: 2,
yellow: 3,
blue: 4,
magenta: 5,
cyan: 6,
white: 7
}
def color_setting
PRECURE_COLOR_SETTING[@precure_name]
end
def foreground_color
COLORS[color_setting[0]]
end
def background_color
COLORS[color_setting[1]]
end
def pretty_print(q)
q.text "\e[3#{foreground_color};4#{background_color}m"
q.text "なまえ: #{@precure_name}"
q.group(2) do
q.breakable
q.text("へんしんまえのなまえ: #{@human_name}")
q.breakable
q.group(2, "へんしんのあいさつ:") do
q.breakable
@transform_message.each_line do |l|
q.text(l.chomp)
q.breakable
end
end
end
q.text "\e[m"
end
def pretty_print_cycle(q)
'...'
end
end
Rubicure::Girl.include(PrettyCurePrinter)
if __FILE__ == $0
Rubicure::Core.instance.all_stars.each do |precure|
pp precure
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment