class Crystalize::CodeConverter

Constants

DEFAULT_OPTIONS
NEWLINE_DELIMITER

Attributes

new_content[R]

Public Class Methods

new(options, content) click to toggle source
# File lib/crystalize/code_converter.rb, line 19
def initialize(options, content)
  @options = options
  @content = transform_semicolons(content)
  @new_content = []
end

Public Instance Methods

convert() click to toggle source
# 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() click to toggle source
# File lib/crystalize/code_converter.rb, line 25
def new_content_string
  @new_content.join(NEWLINE_DELIMITER)
end

Private Instance Methods

by_line(content) { |new_content, line| ... } click to toggle source
# File lib/crystalize/code_converter.rb, line 39
def by_line content, &block
  new_content = []
  content.each do |line|
    yield new_content, line
  end
  new_content
end
check_by_line(content) click to toggle source
# File lib/crystalize/code_converter.rb, line 47
def check_by_line(content)
  by_line(content) do |line|

  end
end
check_full() click to toggle source
# File lib/crystalize/code_converter.rb, line 62
def check_full
end
splitted_content() click to toggle source
# File lib/crystalize/code_converter.rb, line 70
def splitted_content
  @content.split(NEWLINE_DELIMITER)
end
transform_by_line(content) click to toggle source
# File lib/crystalize/code_converter.rb, line 53
def transform_by_line(content)
  by_line(content) do |new_content, line|
    l = line
    l = transform_array_literal(l) if @options[:transform_literals] || @options[:transform_all]
    l = transform_hash_literal(l) if @options[:transform_literals] || @options[:transform_all]
    new_content << l
  end
end
transform_full() click to toggle source
# File lib/crystalize/code_converter.rb, line 65
def transform_full
  @new_content = splitted_content
  @new_content = transform_private_methods(@new_content) if @options[:transform_private] || @options[:transform_all]
end