Module: TypingHelper

Defined in:
app/helpers/typing_helper.rb

Instance Method Summary collapse

Instance Method Details

#fade(array) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/helpers/typing_helper.rb', line 16

def fade array
  answer = "["
  array.each_with_index do |value, index|
    if index != array.count - 1
      answer = answer + """ + "#{value}" + """ + ","
    else
      answer = answer + """ + "#{value}" + """
    end
  end
  answer = answer + "]"
  return "<span class=\"typer-target\" data-typer-targets=\"{&quot;targets&quot;:#{answer}}\"> #{array[array.count-1]}</span>".html_safe
end

#typing(array) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/typing_helper.rb', line 3

def typing array
  answer = "["
  array.each_with_index do |value, index|
    if index != array.count - 1
      answer = answer + "&quot;" + "#{value}" + "&quot;" + ","
    else
      answer = answer + "&quot;" + "#{value}" + "&quot;"
    end
  end
  answer = answer + "]"
  return "<span class=\"typer-target\" data-typer-targets=\"{&quot;targets&quot;:#{answer}}\"> #{array[array.count-1]}</span>".html_safe
end