Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Source#string= method #117

Merged
merged 1 commit into from
Mar 3, 2024
Merged

Conversation

naitoh
Copy link
Contributor

@naitoh naitoh commented Mar 2, 2024

Why?

We want to just change scan pointer.

#114 (comment)

I want to just change scan pointer (StringScanner#pos=) instead of changing @scanner.string.

@@ -211,8 +211,9 @@ def pull_event
#STDERR.puts @source.encoding
#STDERR.puts "BUFFER = #{@source.buffer.inspect}"
if @document_status == nil
pos = @source.pos
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about renaming pos to start_position or something to indicate this is the position before we parsing the next event?

Comment on lines 79 to 83
def pos
@scanner.pos
end

def pos=(pos)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about avoid abbreviation here? The original word isn't so long.

Suggested change
def pos
@scanner.pos
end
def pos=(pos)
def position
@scanner.pos
end
def position=(position)

@naitoh naitoh force-pushed the remove_source_string_method branch from b9ebca5 to ab1816b Compare March 3, 2024 09:29
@naitoh naitoh requested a review from kou March 3, 2024 09:37
## Why?

We want to just change scan pointer.

ruby#114 (comment)
> I want to just change scan pointer (StringScanner#pos=) instead of changing @scanner.string.
@naitoh naitoh force-pushed the remove_source_string_method branch from ab1816b to e59a2af Compare March 3, 2024 10:51
@kou kou merged commit d146162 into ruby:master Mar 3, 2024
39 checks passed
@kou
Copy link
Member

kou commented Mar 3, 2024

Thanks!

@naitoh naitoh deleted the remove_source_string_method branch March 3, 2024 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants