Module: Liquid::Rails::TextFilter
- Defined in:
- lib/liquid-rails/filters/text_filter.rb
Instance Method Summary collapse
- #concat(input, *args) ⇒ Object
- #dasherize(input) ⇒ Object
- #h ⇒ Object
- 
  
    
      #ljust(input, integer, padstr = '')  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    left justify and padd a string. 
- 
  
    
      #rjust(input, integer, padstr = '')  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    right justify and padd a string. 
- #underscore(input) ⇒ Object
Instance Method Details
#concat(input, *args) ⇒ Object
| 31 32 33 34 35 | # File 'lib/liquid-rails/filters/text_filter.rb', line 31 def concat(input, *args) result = input.to_s args.flatten.each { |a| result << a.to_s } result end | 
#dasherize(input) ⇒ Object
| 27 28 29 | # File 'lib/liquid-rails/filters/text_filter.rb', line 27 def dasherize(input) input.to_s.gsub(' ', '-').gsub('/', '-').dasherize end | 
#h ⇒ Object
| 37 38 39 | # File 'lib/liquid-rails/filters/text_filter.rb', line 37 def h @h ||= @context.registers[:view] end | 
#ljust(input, integer, padstr = '') ⇒ Object
left justify and padd a string
| 19 20 21 | # File 'lib/liquid-rails/filters/text_filter.rb', line 19 def ljust(input, integer, padstr = '') input.to_s.ljust(integer, padstr) end | 
#rjust(input, integer, padstr = '') ⇒ Object
right justify and padd a string
| 14 15 16 | # File 'lib/liquid-rails/filters/text_filter.rb', line 14 def rjust(input, integer, padstr = '') input.to_s.rjust(integer, padstr) end | 
#underscore(input) ⇒ Object
| 23 24 25 | # File 'lib/liquid-rails/filters/text_filter.rb', line 23 def underscore(input) input.to_s.gsub(' ', '_').gsub('/', '_').underscore end |