module Utils

require "kaki/utils"

methods

  • Utils.imgexist?(url)
  • Utils.getfile(url, filename, max=0, ua=nil)
  • Utils.key_wait
  • Utils.delete_non_img(file_name)
  • Utils.delete_empty_folder(folder_name = './')
  • Utils.bell    (only Ubuntu)
  • Utils.factorial(n)
  • Utils.permutation(a, b)
  • Utils.combination(a, b)
  • Utils.repeated_permutation(a, b)
  • Utils.repeated_combination(a, b)
  • Utils.generate_random_strings(num, string_length = nil)
  • Utils.m3u8(url, fname)
  • Utils.modify_serial_numbers(dir = Dir.pwd)

Recurring decimal

require "kaki/utils/rec_decimal"

methods

  • Rational#to_rec_decimal
  • String#to_r

image suffix

require "kaki/utils/imgsuffix"

method

  • String#imgsuffix

n times retry

require "kaki/utils/retry"

method

  • Integer#times_retry(message: true, wait: 0)

check overlapping of file names

require "kaki/utils/check_fname_overlapping"

method

  • File.check_fname_overlapping(file_name)

nest loop (like Enumerable#map)

require "kaki/utils/nest_loop"

method

  • Array#nest_loop

add several methods in a module to a class

require "kaki/utils/add_methods"

methods

  • Object#add_methods(module_to_include, *method_names)
  • Module#register_all_methods

instance method of "p"

require "kaki/utils/po"

method

  • Object#po

safe making directory

require "kaki/utils/safe_mkdir"

method

  • Dir.safe_mkdir(dname)

handle escape sequence

require "kaki/utils/es"

methods

  • ES.color(col, opt = nil)
  • ES.csi(*args)
  • ES.cmd(given)
  • ES.esc(str)
  • ES.clear, down, up, reset, top, home, push, pop
  • ES.cursor(x, y = nil)
  • ES.cursor_r(x, y)
  • ES.console_size, cursor_position
  • ES.scroll(rn = nil)
  • ES.safe_scroll(n)
  • ES.scroll_up(n)
  • ES.clear_below

'require' all

require "kaki/utils/all"