Class: Bubs

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

Constant Summary collapse

VERSION =
'0.0.4'

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.



8
9
10
# File 'lib/bubs.rb', line 8

def self.convert(text)
  text.tr('A-Za-z1-90', 'Ⓐ-Ⓩⓐ-ⓩ①-⑨⓪')
end

.copy(text) ⇒ Object

Copies the text to clipboard

… not in windows, tho



15
16
17
18
19
20
21
22
23
24
# File 'lib/bubs.rb', line 15

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

  copycmd && system("printf \"#{text}\" | #{copycmd}")
end