Class: Ragel::Array::Replace

Inherits:
Ripper::SexpBuilderPP
  • Object
show all
Defined in:
lib/ragel/array/replace.rb

Defined Under Namespace

Classes: Buffer, Table

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeReplace

Returns a new instance of Replace.



46
47
48
49
# File 'lib/ragel/array/replace.rb', line 46

def initialize(*)
  super
  @tables = []
end

Instance Attribute Details

#tablesObject (readonly)

Returns the value of attribute tables.



44
45
46
# File 'lib/ragel/array/replace.rb', line 44

def tables
  @tables
end

Class Method Details

.replace(source) ⇒ Object



62
63
64
65
66
# File 'lib/ragel/array/replace.rb', line 62

def self.replace(source)
  buffer = Buffer.new(source)
  new(source).each_table { |table| buffer.replace(table) }
  buffer.to_source
end

Instance Method Details

#each_table(&block) ⇒ Object



51
52
53
54
55
56
57
58
59
60
# File 'lib/ragel/array/replace.rb', line 51

def each_table(&block)
  parse

  if error?
    warn 'Invalid ruby'
    exit 1
  end

  tables.reverse_each(&block)
end