Class: Crystalize::CodeConverter
- Inherits:
-
Object
- Object
- Crystalize::CodeConverter
- Includes:
- Crystalize::Check::Line::Literals, Transform::Code::Semicolons, Transform::Line::Literals, Transform::Line::PrivateMethods
- Defined in:
- lib/crystalize/code_converter.rb
Constant Summary collapse
- NEWLINE_DELIMITER =
"\n"
- DEFAULT_OPTIONS =
{ transform_all: true }
Instance Attribute Summary collapse
-
#new_content ⇒ Object
readonly
Returns the value of attribute new_content.
Instance Method Summary collapse
- #convert ⇒ Object
-
#initialize(options, content) ⇒ CodeConverter
constructor
A new instance of CodeConverter.
- #new_content_string ⇒ Object
Methods included from Transform::Code::Semicolons
Methods included from Transform::Line::PrivateMethods
#add_visibility_prefix_to_method, #line_without_private, #method_in_line?, #private_in_line?, #protected_in_line?, #public_in_line?, #self_method_in_line?, #tabulation, #transform_private_methods
Methods included from Transform::Line::Literals
#lambda_call_in_line?, #transform_array_literal, #transform_hash_literal
Constructor Details
#initialize(options, content) ⇒ CodeConverter
Returns a new instance of CodeConverter.
19 20 21 22 23 |
# File 'lib/crystalize/code_converter.rb', line 19 def initialize(, content) @options = @content = transform_semicolons(content) @new_content = [] end |
Instance Attribute Details
#new_content ⇒ Object (readonly)
Returns the value of attribute new_content.
12 13 14 |
# File 'lib/crystalize/code_converter.rb', line 12 def new_content @new_content end |
Instance Method Details
#convert ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/crystalize/code_converter.rb', line 29 def convert # check_by_line check_full transform_full @new_content = transform_by_line(@new_content) end |
#new_content_string ⇒ Object
25 26 27 |
# File 'lib/crystalize/code_converter.rb', line 25 def new_content_string @new_content.join(NEWLINE_DELIMITER) end |