Class: Safai::Clean

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

Class Method Summary collapse

Class Method Details

.floated_string(f) ⇒ Object

Remove the unnecessary .0 that gets added to floated strings



12
13
14
15
# File 'lib/safai/clean.rb', line 12

def self.floated_string(f)
  f = f.to_s
  return f.index(".0").nil? ? f : f[0, f.index(".0")]
end

.url(link) ⇒ Object

Standardize how web URLs are presented



4
5
6
7
8
9
# File 'lib/safai/clean.rb', line 4

def self.url(link)
  link = link.gsub("http://", "")
  link = link.gsub("https://", "")
  link = link.gsub("www.", "")
  return "http://#{link}"
end