Module: Locomotive::Steam::Liquid::Filters::Text
- Defined in:
- lib/locomotive/steam/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.
- #parameterize(input) ⇒ Object
-
#rjust(input, integer, padstr = '') ⇒ Object
right justify and padd a string.
- #textile(input) ⇒ Object
- #underscore(input) ⇒ Object
Instance Method Details
#concat(input, *args) ⇒ Object
28 29 30 31 32 |
# File 'lib/locomotive/steam/liquid/filters/text.rb', line 28 def concat(input, *args) result = input.to_s args.flatten.each { |a| result << a.to_s } result end |
#dasherize(input) ⇒ Object
11 12 13 |
# File 'lib/locomotive/steam/liquid/filters/text.rb', line 11 def dasherize(input) input.to_s.gsub(' ', '-').gsub('/', '-').dasherize end |
#encode(input) ⇒ Object
15 16 17 |
# File 'lib/locomotive/steam/liquid/filters/text.rb', line 15 def encode(input) Rack::Utils.escape(input) end |
#ljust(input, integer, padstr = '') ⇒ Object
left justify and padd a string
40 41 42 |
# File 'lib/locomotive/steam/liquid/filters/text.rb', line 40 def ljust(input, integer, padstr = '') input.to_s.ljust(integer, padstr) end |
#markdown(input) ⇒ Object
48 49 50 |
# File 'lib/locomotive/steam/liquid/filters/text.rb', line 48 def markdown(input) @context.registers[:services].markdown.to_html(input) end |
#multi_line(input) ⇒ Object
alias newline_to_br
24 25 26 |
# File 'lib/locomotive/steam/liquid/filters/text.rb', line 24 def multi_line(input) input.to_s.gsub("\n", '<br/>') end |
#parameterize(input) ⇒ Object
19 20 21 |
# File 'lib/locomotive/steam/liquid/filters/text.rb', line 19 def parameterize(input) input.parameterize end |
#rjust(input, integer, padstr = '') ⇒ Object
right justify and padd a string
35 36 37 |
# File 'lib/locomotive/steam/liquid/filters/text.rb', line 35 def rjust(input, integer, padstr = '') input.to_s.rjust(integer, padstr) end |
#textile(input) ⇒ Object
44 45 46 |
# File 'lib/locomotive/steam/liquid/filters/text.rb', line 44 def textile(input) @context.registers[:services].textile.to_html(input) end |
#underscore(input) ⇒ Object
7 8 9 |
# File 'lib/locomotive/steam/liquid/filters/text.rb', line 7 def underscore(input) input.to_s.gsub(' ', '_').gsub('/', '_').underscore end |