Class: Persian::Url

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

Overview

Persian Unicode class

Class Method Summary collapse

Class Method Details

.urlify(text) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/persian/url.rb', line 7

def self.urlify(text)
  # remove brackets
  text = Text.remove_brackets(text)
  # remove harekats
  text = Text.remove_harekats(text)
  # remove slash and backslash
  text.gsub!(%r{(\/||\\)}, '')
  # remove signs
  text = Text.remove_signs(text, ' ')
  # Remove extra spaces
  text = Text.remove_extra_spaces(text)
  # trim spaces from start and end of text
  text = text.strip
  # replace space with dash
  text.gsub!(/\s/, '-')
  text
end