Sha256: c1aab3a336d910864bc2ed3fb4dd9ab9ce250525f553df20d0461d28edb446f2
Contents?: true
Size: 773 Bytes
Versions: 5
Compression:
Stored size: 773 Bytes
Contents
module MasterView module Directives # outputs a block around the text tags, if left bracket count is higher than right # assume that the end is a right bracket otherwise use end # class Block < MasterView::DirectiveBase metadata :priority => 'MediumHigh', :category => 'erb', :description => 'Expands to the equivalent rhtml (erb) block code around the element' event :before_stag do count_left_brackets = attr_value.scan( /\{/ ).size count_right_brackets = attr_value.scan( /\}/ ).size @end_block = (count_left_brackets > count_right_brackets) ? '}' : 'end' render erb_eval(attr_value) end event :after_etag do render erb_eval(@end_block) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems