Class: I18nliner::PreProcessors::ErbPreProcessor::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/i18nliner/pre_processors/erb_pre_processor.rb

Direct Known Subclasses

TBlock

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent = nil) ⇒ Context

Returns a new instance of Context.



15
16
17
18
# File 'lib/i18nliner/pre_processors/erb_pre_processor.rb', line 15

def initialize(parent = nil)
  @parent = parent
  @buffer = ''
end

Instance Attribute Details

#bufferObject (readonly)

Returns the value of attribute buffer.



13
14
15
# File 'lib/i18nliner/pre_processors/erb_pre_processor.rb', line 13

def buffer
  @buffer
end

#parentObject (readonly)

Returns the value of attribute parent.



13
14
15
# File 'lib/i18nliner/pre_processors/erb_pre_processor.rb', line 13

def parent
  @parent
end

Instance Method Details

#<<(string) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/i18nliner/pre_processors/erb_pre_processor.rb', line 20

def <<(string)
  if string =~ ERB_T_BLOCK_EXPRESSION
    TBlock.new(self, $&)
  else
    @buffer << string
    self
  end
end

#resultObject



29
30
31
# File 'lib/i18nliner/pre_processors/erb_pre_processor.rb', line 29

def result
  @buffer
end