Sha256: 9fb5a97a618a23e79816e961e6e8ce3ec14c7200aa789860d350dcc71ce471c0
Contents?: true
Size: 666 Bytes
Versions: 7
Compression:
Stored size: 666 Bytes
Contents
require "multi_json" module Skim class Sections < Slim::Sections def call(exp) if options[:sections] compile(exp) else exp end end protected def on_slim_inverted_section(name, content) [:if, "not #{access(name)}", compile(content)] end def on_slim_section(name, content) tmp1, tmp2 = unique_name, unique_name [:if, "#{tmp1} = #{access(name)}", [:block, "for #{tmp2} in #{tmp1}", [:block, "Skim.withContext.call @, #{tmp2}, ->", compile(content)]]] end private def access(name) "Skim.access.call(@, #{MultiJson.encode(name.to_s)})" end end end
Version data entries
7 entries across 7 versions & 1 rubygems