Class: MasterView::Directives::GlobalInlineErb

Inherits:
MasterView::DirectiveBase
  • Object
show all
Defined in:
lib/masterview/directives/global_inline_erb.rb

Overview

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

Instance Method Summary collapse

Constructor Details

#initialize(attribute_value = nil) ⇒ GlobalInlineErb

Returns a new instance of GlobalInlineErb.



13
14
15
# File 'lib/masterview/directives/global_inline_erb.rb', line 13

def initialize(attribute_value = nil)
  super(attribute_value)
end

Instance Method Details

#characters(dcs) ⇒ Object



23
24
25
26
# File 'lib/masterview/directives/global_inline_erb.rb', line 23

def characters(dcs)
  replace_with_erb!( data )
  dcs.render
end

#replace_with_erb!(value) ⇒ Object



28
29
30
# File 'lib/masterview/directives/global_inline_erb.rb', line 28

def replace_with_erb!(value)
  subs = value.gsub!( MasterView::InlineErbSubstitutionRegex, '<%\1%>' )
end