Module: Locomotive::Liquid::Filters::Text

Defined in:
lib/locomotive/liquid/filters/text.rb

Instance Method Summary collapse

Instance Method Details

#concat(input, *args) ⇒ Object



19
20
21
22
23
# File 'lib/locomotive/liquid/filters/text.rb', line 19

def concat(input, *args)
  result = input.to_s
  args.flatten.each { |a| result << a.to_s }
  result
end

#dasherize(input) ⇒ Object



10
11
12
# File 'lib/locomotive/liquid/filters/text.rb', line 10

def dasherize(input)
  input.to_s.gsub(' ', '-').gsub('/', '-').dasherize
end

#ljust(input, integer, padstr = '') ⇒ Object

left justify and padd a string



31
32
33
# File 'lib/locomotive/liquid/filters/text.rb', line 31

def ljust(input, integer, padstr = '')
  input.ljust(integer, padstr)
end

#multi_line(input) ⇒ Object

alias newline_to_br



15
16
17
# File 'lib/locomotive/liquid/filters/text.rb', line 15

def multi_line(input)
  input.to_s.gsub("\n", '<br/>')
end

#rjust(input, integer, padstr = '') ⇒ Object

right justify and padd a string



26
27
28
# File 'lib/locomotive/liquid/filters/text.rb', line 26

def rjust(input, integer, padstr = '')
  input.rjust(integer, padstr)
end

#textile(input) ⇒ Object



35
36
37
# File 'lib/locomotive/liquid/filters/text.rb', line 35

def textile(input)
  ::RedCloth.new(input).to_html
end

#underscore(input) ⇒ Object



6
7
8
# File 'lib/locomotive/liquid/filters/text.rb', line 6

def underscore(input)
  input.to_s.gsub(' ', '_').gsub('/', '_').underscore
end