Module: ActsAsCode
- Included in:
- OpenStatement, Statement, TheoryComponent
- Defined in:
- lib/core/ActsAsCode.rb
Overview
This module is used in the various code containers used in Cauldren
Instance Method Summary collapse
-
#write_structure ⇒ Object
Returns a string description of the statement with any of tokens replaced with token markers.
Instance Method Details
#write_structure ⇒ Object
Returns a string description of the statement with any of tokens replaced with token markers.
So var_1 = var_2 + 3
becomes a = b + c
The order of replacement is important, the first token becomes a, the second b and so forth.
16 17 18 19 20 21 22 23 |
# File 'lib/core/ActsAsCode.rb', line 16 def write_structure # TODO Not sure how to handle duplicate literals output = self.write self.tokens.zip(('a'..'z').to_a) do |x,y| output.gsub!(x.write,y) end return output end |