Module: Localite::Format

Defined in:
lib/localite/format.rb

Defined Under Namespace

Modules: Etest

Class Method Summary collapse

Class Method Details

.html(s) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/localite/format.rb', line 12

def self.html(s)
  case s
  when /html:(.*)/m then $1
  when /text:(.*)/m then CGI.escapeHTML($1)
  else              CGI.escapeHTML(s)
  end
end

.text(s) ⇒ Object

convert from text into target format



4
5
6
7
8
9
10
# File 'lib/localite/format.rb', line 4

def self.text(s)
  case s
  when /html:(.*)/m then $1
  when /text:(.*)/m then $1
  else              s
  end
end