Class: Bubs

Inherits:
Object
  • Object
show all
Defined in:
lib/bubs.rb

Constant Summary collapse

VERSION =
'0.0.2'
CONVERT_MAP =
{
  'A' => 'Ⓐ',
  'B' => 'Ⓑ',
  'C' => 'Ⓒ',
  'D' => 'Ⓓ',
  'E' => 'Ⓔ',
  'F' => 'Ⓕ',
  'G' => 'Ⓖ',
  'H' => 'Ⓗ',
  'I' => 'Ⓘ',
  'J' => 'Ⓙ',
  'K' => 'Ⓚ',
  'L' => 'Ⓛ',
  'M' => 'Ⓜ',
  'N' => 'Ⓝ',
  'O' => 'Ⓞ',
  'P' => 'Ⓟ',
  'Q' => 'Ⓠ',
  'R' => 'Ⓡ',
  'S' => 'Ⓢ',
  'T' => 'Ⓣ',
  'U' => 'Ⓤ',
  'V' => 'Ⓥ',
  'W' => 'Ⓦ',
  'X' => 'Ⓧ',
  'Y' => 'Ⓨ',
  'Z' => 'Ⓩ',
  'a' => 'ⓐ',
  'b' => 'ⓑ',
  'c' => 'ⓒ',
  'd' => 'ⓓ',
  'e' => 'ⓔ',
  'f' => 'ⓕ',
  'g' => 'ⓖ',
  'h' => 'ⓗ',
  'i' => 'ⓘ',
  'j' => 'ⓙ',
  'k' => 'ⓚ',
  'l' => 'ⓛ',
  'm' => 'ⓜ',
  'n' => 'ⓝ',
  'o' => 'ⓞ',
  'p' => 'ⓟ',
  'q' => 'ⓠ',
  'r' => 'ⓡ',
  's' => 'ⓢ',
  't' => 'ⓣ',
  'u' => 'ⓤ',
  'v' => 'ⓥ',
  'w' => 'ⓦ',
  'x' => 'ⓧ',
  'y' => 'ⓨ',
  'z' => 'ⓩ',
  '1' => '①',
  '2' => '②',
  '3' => '③',
  '4' => '④',
  '5' => '⑤',
  '6' => '⑥',
  '7' => '⑦',
  '8' => '⑧',
  '9' => '⑨',
  '0' => '⓪'
}

Class Method Summary collapse

Class Method Details

.convert(text) ⇒ Object

Convert words to ⓌⓄⓇⒹⓈ.

Returns a String, but a much cooler string than what you had initially.



73
74
75
# File 'lib/bubs.rb', line 73

def self.convert(text)
  text.gsub(/[a-z0-9]/i, CONVERT_MAP)
end

.copy(text) ⇒ Object

Copies the text to clipboard

… not in windows, tho



80
81
82
83
84
85
86
87
88
89
# File 'lib/bubs.rb', line 80

def self.copy(text)
  copycmd = case RUBY_PLATFORM
  when /darwin/
    'pbcopy'
  when /linux/
    'xclip'
  end

  copycmd && `printf "#{text}" | #{copycmd}`
end