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 Global_inline_erb < MasterView::DirectiveBase def initialize(attribute_value = nil) super(attribute_value) end def priority DirectivePriorities::Low end def global_directive? true end def stag(dcs) attrs.each do |key, value| replace_with_erb!( value ) end dcs.render end def characters(dcs) replace_with_erb!( data ) dcs.render end private def replace_with_erb!(value) subs = value.gsub!( MasterView::InlineErbSubstitutionRegex, '<%\1%>' ) end end end end