Sha256: 4515417cf37c94a85fac784fbc29ccbea3181905315b30054cce429558ec6542
Contents?: true
Size: 984 Bytes
Versions: 2
Compression:
Stored size: 984 Bytes
Contents
module Liquid module Rails module TextFilter delegate \ :highlight, :excerpt, :pluralize, :word_wrap, :simple_format, to: :h # right justify and padd a string def rjust(input, integer, padstr = '') input.to_s.rjust(integer, padstr) end # left justify and padd a string def ljust(input, integer, padstr = '') input.to_s.ljust(integer, padstr) end def underscore(input) input.to_s.gsub(' ', '_').gsub('/', '_').underscore end def dasherize(input) input.to_s.gsub(' ', '-').gsub('/', '-').dasherize end def concat(input, *args) result = input.to_s args.flatten.each { |a| result << a.to_s } result end def h @h ||= @context.registers[:view] end end end end Liquid::Template.register_filter(Liquid::Rails::TextFilter)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
liquid4-rails5-0.2.1 | lib/liquid-rails/filters/text_filter.rb |
liquid4-rails5-0.1.5 | lib/liquid-rails/filters/text_filter.rb |