Module: Locomotive::Liquid::Filters::Text
- Defined in:
- lib/locomotive/liquid/filters/text.rb
Instance Method Summary collapse
- #concat(input, *args) ⇒ Object
- #dasherize(input) ⇒ Object
- #encode(input) ⇒ Object
-
#ljust(input, integer, padstr = '') ⇒ Object
left justify and padd a string.
- #markdown(input) ⇒ Object
-
#multi_line(input) ⇒ Object
alias newline_to_br.
-
#rjust(input, integer, padstr = '') ⇒ Object
right justify and padd a string.
- #textile(input) ⇒ Object
- #underscore(input) ⇒ Object
Instance Method Details
#concat(input, *args) ⇒ Object
23 24 25 26 27 |
# File 'lib/locomotive/liquid/filters/text.rb', line 23 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 |
#encode(input) ⇒ Object
14 15 16 |
# File 'lib/locomotive/liquid/filters/text.rb', line 14 def encode(input) Rack::Utils.escape(input) end |
#ljust(input, integer, padstr = '') ⇒ Object
left justify and padd a string
35 36 37 |
# File 'lib/locomotive/liquid/filters/text.rb', line 35 def ljust(input, integer, padstr = '') input.to_s.ljust(integer, padstr) end |
#markdown(input) ⇒ Object
43 44 45 |
# File 'lib/locomotive/liquid/filters/text.rb', line 43 def markdown(input) Locomotive::Markdown.render(input) end |
#multi_line(input) ⇒ Object
alias newline_to_br
19 20 21 |
# File 'lib/locomotive/liquid/filters/text.rb', line 19 def multi_line(input) input.to_s.gsub("\n", '<br/>') end |
#rjust(input, integer, padstr = '') ⇒ Object
right justify and padd a string
30 31 32 |
# File 'lib/locomotive/liquid/filters/text.rb', line 30 def rjust(input, integer, padstr = '') input.to_s.rjust(integer, padstr) end |
#textile(input) ⇒ Object
39 40 41 |
# File 'lib/locomotive/liquid/filters/text.rb', line 39 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 |