Sha256: 183fb23dfa7d965743147ea010dde706226ee86f8cfb57ab677e957c2665c63a

Contents?: true

Size: 488 Bytes

Versions: 7

Compression:

Stored size: 488 Bytes

Contents

# frozen_string_literal: true

# Sets the value in the session
#
# {%set_session name value%}
# {%set_session locale 'nl'%}
# {%set_session locale request.query_parameters['lang']%}
# {%set_session locale request.query_parameters['lang']%}
# {%set_session coupon_code 'beyou'%}
class SetSessionTag < LiquidumTag
  def render(context)
    super

    context.registers['controller'].session[argv1] = sargs.first
    ''
  end
end

Liquid::Template.register_tag('set_session', SetSessionTag)

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
scribo-1.0.44 lib/scribo/liquid/tags/set_session.rb
scribo-1.0.43 lib/scribo/liquid/tags/set_session.rb
scribo-1.0.42 lib/scribo/liquid/tags/set_session.rb
scribo-1.0.41 lib/scribo/liquid/tags/set_session.rb
scribo-1.0.40 lib/scribo/liquid/tags/set_session.rb
scribo-1.0.39 lib/scribo/liquid/tags/set_session.rb
scribo-1.0.38 lib/scribo/liquid/tags/set_session.rb