Class: Quotinator

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

Class Method Summary collapse

Class Method Details

.aboutObject



5
6
7
8
9
# File 'lib/quotinator.rb', line 5

def self.about
  puts "This is a basic gem which is designed to replace all "
  puts "the special and fancy characters Microsoft places in "
  puts "its text with the basic counterparts."
end

.doublequotes(txt) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/quotinator.rb', line 26

def self.doublequotes(txt)
  txt = txt.gsub(//,'"').gsub(//,'"')
  # There seems to be two different sets of special quotes.
  txt = txt.gsub(//,'"').gsub(//,'"')
  txt.gsub!(/[\u201c\u201d]/, '"')
  return txt
end

.ellipsis(txt) ⇒ Object



39
40
41
42
# File 'lib/quotinator.rb', line 39

def self.ellipsis(txt)
  txt.gsub!(//,"...")
  return txt
end

.longdash(txt) ⇒ Object



44
45
46
47
# File 'lib/quotinator.rb', line 44

def self.longdash(txt)
  txt.gsub!(//,"-")
  return txt
end

.replace(txt) ⇒ Object

Just a shorthand function for the replace_all function.



12
13
14
# File 'lib/quotinator.rb', line 12

def self.replace(txt)
  return replace_all(txt)
end

.replace_all(txt) ⇒ Object

txt.gsub!(/ /,“ ”) ?? Need to figure this character out.



18
19
20
21
22
23
24
# File 'lib/quotinator.rb', line 18

def self.replace_all(txt)
  txt = doublequotes(txt)
  txt = singlequotes(txt)
  txt = ellipsis(txt)
  txt = longdash(txt)
  return txt
end

.singlequotes(txt) ⇒ Object



34
35
36
37
# File 'lib/quotinator.rb', line 34

def self.singlequotes(txt)
  txt = txt.gsub(//,"'").gsub(//,"'")
  return txt
end