| Module | ApplicationHelper |
| In: |
app/helpers/application_helper.rb
|
Methods added to this helper will be available to all templates in the application.
| RMETHOD_S | = | '(http|https|ftp)' |
| HOST_S | = | '([\w-]+\.)+(\w{2,})' |
| PORT_S | = | '(:\d+)?' |
| PATH_S | = | '(\/[\w.=~-]+)*' |
| PARAM_S | = | '([\w.-])+(=[\w./-]+)?' |
| PARAMS_S | = | "(\\?#{PARAM_S}((&|;)#{PARAM_S})*)?" |
| ANCHOR_S | = | '(#[\w.-]+)?' |
| RE_URL | = | /\b(#{RMETHOD_S}:\/\/#{HOST_S}#{PORT_S}#{PATH_S}#{PARAMS_S}#{ANCHOR_S})\b/ |
| RE_EMAIL | = | /\b([\w=.-]+@([\w-]+.)+\w{2,})\b/ |
# File app/helpers/application_helper.rb, line 28
28: def interval2string(seconds, including_seconds = true)
29: hours = (seconds / 3600).to_i
30: mins = ((seconds % 3600) / 60).to_i
31: secs = (seconds % 60).to_i
32: res = sprintf("%02d:%02d:%02d", hours, mins, secs)
33: res += " (#{sprintf('%.5f', seconds)} seconds)" if(including_seconds)
34: res
35: end
# File app/helpers/application_helper.rb, line 37
37: def rd2html(aRdString)
38: unless(@_smarkup)
39: @_smarkup = SM::SimpleMarkup.new
40: @_myhtml = MyHtml.new
41: @_smarkup.add_special(RE_EMAIL, :EMAIL)
42: @_smarkup.add_special(RE_URL, :URL)
43: end
44:
45: return @_smarkup.convert(aRdString, @_myhtml)
46: end