Class: FrontCompiler::SourceCode
- Inherits:
-
String
- Object
- String
- FrontCompiler::SourceCode
- Defined in:
- lib/front_compiler/source_code.rb
Overview
That’s all the source-codes base class
Copyright © Nikolay V. Nemshilov aka St.
Direct Known Subclasses
Instance Method Summary collapse
-
#compact ⇒ Object
don’t use alias here, it won’t work with subclasses.
-
#compact! ⇒ Object
returns a fully compacted source.
-
#initialize(src) ⇒ SourceCode
constructor
A new instance of SourceCode.
-
#remove_comments! ⇒ Object
removes any comments.
-
#remove_empty_lines! ⇒ Object
removes empty lines.
-
#remove_trailing_spaces! ⇒ Object
removes all the trailing spaces.
Constructor Details
#initialize(src) ⇒ SourceCode
Returns a new instance of SourceCode.
7 8 9 |
# File 'lib/front_compiler/source_code.rb', line 7 def initialize(src) super src end |
Instance Method Details
#compact ⇒ Object
don’t use alias here, it won’t work with subclasses
34 35 36 |
# File 'lib/front_compiler/source_code.rb', line 34 def compact compact! end |
#compact! ⇒ Object
returns a fully compacted source
12 13 14 15 16 |
# File 'lib/front_compiler/source_code.rb', line 12 def compact! remove_comments!. remove_empty_lines!. remove_trailing_spaces! end |
#remove_comments! ⇒ Object
removes any comments
19 20 21 |
# File 'lib/front_compiler/source_code.rb', line 19 def remove_comments! self end |
#remove_empty_lines! ⇒ Object
removes empty lines
24 25 26 |
# File 'lib/front_compiler/source_code.rb', line 24 def remove_empty_lines! self end |
#remove_trailing_spaces! ⇒ Object
removes all the trailing spaces
29 30 31 |
# File 'lib/front_compiler/source_code.rb', line 29 def remove_trailing_spaces! self end |