Module: StringWizard

Defined in:
lib/gooddata_marketo/helpers/stringwizard.rb

Constant Summary collapse

DATE_FORMATS =
['%m/%d/%Y %I:%M:%S %p', '%Y/%m/%d %H:%M:%S', '%d/%m/%Y %H:%M', '%m/%d/%Y', '%Y/%m/%d']

Class Method Summary collapse

Class Method Details

.escape_special_characters(string) ⇒ Object



26
27
28
29
30
# File 'lib/gooddata_marketo/helpers/stringwizard.rb', line 26

def escape_special_characters string
  pattern = /(\'|\*|\-|\\)/
  m = string.gsub(pattern){|match|""  + match}
  m.gsub("\n","")
end

.time(unparsed_time) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/gooddata_marketo/helpers/stringwizard.rb', line 8

def time unparsed_time
  Time.parse(unparsed_time).to_s
  # DATE_FORMATS.each do |format|
  #   begin
  #     @time_string = Date.strptime(unparsed_time, format)
  #   rescue
  #     next
  #   end
  # end
  #
  # if @time_string.to_s.empty?
  #   nil
  # else
  #   @time_string.to_s
  # end

end