Sha256: a51140a828b5bcc24a0e7a17368f99106899acbd57fc07e5b53e58be7a6454a9
Contents?: true
Size: 732 Bytes
Versions: 5
Compression:
Stored size: 732 Bytes
Contents
module Cms::TagCommon extend ActiveSupport::Memoizable HyphenatedTagAttributes = /([\w-]+)\s*\:\s*(#{Liquid::QuotedFragment})/ def parse_options(context, markup) begin options = HashWithIndifferentAccess.new return options if markup.blank? markup.scan(HyphenatedTagAttributes) do |key, value| options[key.to_sym] = context[value] end options rescue ArgumentError => e raise SyntaxError.new("Syntax Error in 'tag options' - Valid syntax: name:value") end end def context_object(context) context.registers[:context].object end memoize :context_object def params(context) context.registers[:controller].params.except(:controller, :action) end end
Version data entries
5 entries across 5 versions & 1 rubygems