Class: Crystalize::CodeConverter

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Methods included from Transform::Code::Semicolons

#transform_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(options, content)
  @options = options
  @content = transform_semicolons(content)
  @new_content = []
end

Instance Attribute Details

#new_contentObject (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

#convertObject



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 = (@new_content)
end

#new_content_stringObject



25
26
27
# File 'lib/crystalize/code_converter.rb', line 25

def new_content_string
  @new_content.join(NEWLINE_DELIMITER)
end