Sha256: 1a69e2f5ba6dea40bc13b5f36eaf00c8b0716d3e70f0370e23ba33c510c754a3

Contents?: true

Size: 727 Bytes

Versions: 17

Compression:

Stored size: 727 Bytes

Contents

require File.dirname(__FILE__) + '/../test_helper'

class LiquidRender
  
  def initialize(drops = {})
    @objects_hash = [
      {'name' => 'one', "value" => 10},
      {'name' => 'two', "value" => 5},
      {'name' => 'three', "value" => 6}
    ]
    @registers = {}
    @assigns = {}
    @assigns['objects_arr'] = @objects_hash
    @assigns['now'] = Time.now
    @assigns['today'] = Date.today.strftime(date_format)
    drops.each do |key, drop|
      @assigns[key] = drop
    end
  end

  def render(content)
    ::Liquid::Template.parse(content).render(::Liquid::Context.new({}, @assigns, @registers)).html_safe
  rescue => e
    e.message
  end
end

module LiquidHelperMethods
  def date_format
    '%d.%m.%Y'
  end
end

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
redmine_crm-0.0.40 test/liquid/liquid_helper.rb
redmine_crm-0.0.38 test/liquid/liquid_helper.rb
yeshua_crm-1.0.1 test/liquid/liquid_helper.rb
yeshua_crm-1.0.0 test/liquid/liquid_helper.rb
yeshoua_crm-1.0.0 test/liquid/liquid_helper.rb
redmine_crm-0.0.37 test/liquid/liquid_helper.rb
redmine_crm-0.0.36 test/liquid/liquid_helper.rb
redmine_crm-0.0.35 test/liquid/liquid_helper.rb
redmine_crm-0.0.34 test/liquid/liquid_helper.rb
redmine_crm-0.0.33 test/liquid/liquid_helper.rb
redmine_crm-0.0.32 test/liquid/liquid_helper.rb
redmine_crm-0.0.31 test/liquid/liquid_helper.rb
redmine_crm-0.0.30 test/liquid/liquid_helper.rb
redmine_crm-0.0.28 test/liquid/liquid_helper.rb
redmine_crm-0.0.27 test/liquid/liquid_helper.rb
redmine_crm-0.0.26 test/liquid/liquid_helper.rb
redmine_crm-0.0.25 test/liquid/liquid_helper.rb