Class: SeeingIsBelieving::Binary::CommentableLines
- Inherits:
-
Object
- Object
- SeeingIsBelieving::Binary::CommentableLines
- Defined in:
- lib/seeing_is_believing/binary/commentable_lines.rb
Instance Attribute Summary collapse
- #buffer ⇒ Object readonly
- #rewriter ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(code) ⇒ CommentableLines
constructor
A new instance of CommentableLines.
Constructor Details
#initialize(code) ⇒ CommentableLines
Returns a new instance of CommentableLines.
11 12 13 14 |
# File 'lib/seeing_is_believing/binary/commentable_lines.rb', line 11 def initialize(code) self.code = code self.code_obj = Code.new(code, 'finding_commentable_lines') end |
Instance Attribute Details
#buffer ⇒ Object
27 28 29 |
# File 'lib/seeing_is_believing/binary/commentable_lines.rb', line 27 def buffer code_obj.buffer end |
#rewriter ⇒ Object
31 32 33 |
# File 'lib/seeing_is_believing/binary/commentable_lines.rb', line 31 def rewriter code_obj.rewriter end |
Class Method Details
.call(code) ⇒ Object
7 8 9 |
# File 'lib/seeing_is_believing/binary/commentable_lines.rb', line 7 def self.call(code) new(code).call end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/seeing_is_believing/binary/commentable_lines.rb', line 16 def call @call ||= begin line_num_to_location = line_nums_to_last_index_and_col(buffer) remove_lines_after_data_segment line_num_to_location remove_lines_whose_newline_is_escaped line_num_to_location remove_lines_ending_in_comments line_num_to_location, code_obj.raw_comments remove_lines_inside_of_strings_and_things line_num_to_location, root line_num_to_location end end |