Class: RageFlip::Underline

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

Constant Summary collapse

UNDERLINE_CHAR =
"\u0332"
DOUBLE_UNDERLINE_CHAR =
"\u0333"

Class Method Summary collapse

Class Method Details

.double_underline(text) ⇒ Object



15
16
17
# File 'lib/rage_flip/underline.rb', line 15

def self.double_underline(text)
  process(text, double: true)
end

.process(text, double: false) ⇒ Object



6
7
8
9
# File 'lib/rage_flip/underline.rb', line 6

def self.process(text, double: false)
  underline_char = double ? DOUBLE_UNDERLINE_CHAR : UNDERLINE_CHAR
  text.each_char.map { |c| [c, underline_char] }.join
end

.single_underline(text) ⇒ Object



11
12
13
# File 'lib/rage_flip/underline.rb', line 11

def self.single_underline(text)
  process(text, double: false)
end