Module: Locomotive::Liquid::Filters::Text
- Defined in:
- lib/locomotive/liquid/filters/text.rb
Instance Method Summary (collapse)
- - (Object) concat(input, *args)
- - (Object) dasherize(input)
-
- (Object) ljust(input, integer, padstr = '')
left justify and padd a string.
-
- (Object) multi_line(input)
alias newline_to_br.
-
- (Object) rjust(input, integer, padstr = '')
right justify and padd a string.
- - (Object) textile(input)
- - (Object) underscore(input)
Instance Method Details
- (Object) concat(input, *args)
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 |
- (Object) dasherize(input)
10 11 12 |
# File 'lib/locomotive/liquid/filters/text.rb', line 10 def dasherize(input) input.to_s.gsub(' ', '-').gsub('/', '-').dasherize end |
- (Object) ljust(input, integer, padstr = '')
left justify and padd a string
31 32 33 |
# File 'lib/locomotive/liquid/filters/text.rb', line 31 def ljust(input, integer, padstr = '') input.to_s.ljust(integer, padstr) end |
- (Object) multi_line(input)
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 |
- (Object) rjust(input, integer, padstr = '')
right justify and padd a string
26 27 28 |
# File 'lib/locomotive/liquid/filters/text.rb', line 26 def rjust(input, integer, padstr = '') input.to_s.rjust(integer, padstr) end |
- (Object) textile(input)
35 36 37 |
# File 'lib/locomotive/liquid/filters/text.rb', line 35 def textile(input) ::RedCloth.new(input).to_html end |
- (Object) underscore(input)
6 7 8 |
# File 'lib/locomotive/liquid/filters/text.rb', line 6 def underscore(input) input.to_s.gsub(' ', '_').gsub('/', '_').underscore end |