Sha256: 3e2ed85a8538b1eac64e5bcb46860af317f09044931259a0d3902a115570b414
Contents?: true
Size: 965 Bytes
Versions: 1
Compression:
Stored size: 965 Bytes
Contents
module Liquid module Rails module TextFilter delegate \ :highlight, :excerpt, :pluralize, :word_wrap, :simple_format, to: :view # 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 private def view @view ||= @context.registers[:view] end end end end Liquid::Template.register_filter(Liquid::Rails::TextFilter)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
liquid4-rails-0.2.0 | lib/liquid4-rails/filters/text_filter.rb |