Project

General

Profile

Actions

Misc #18125

closed

A strange behavior when same name variable/method coexist issue.

Added by zw963 (Wei Zheng) over 2 years ago. Updated over 2 years ago.

Status:
Closed
Assignee:
-
[ruby-core:105041]

Description

Following is a example.

Reproduce

def deploy_to
  "deploy_to"
end

deploy_to = "#{deploy_to} new place"

p defined? deploy_to # => local_varible
p deploy_to  # => " new place"

What we expected.

def deploy_to
  "deploy_to"
end

deploy_to = "#{deploy_to} new place"

p defined? deploy_to # => local_varible
p deploy_to  # => "deploy_to new place"

This strange behavior i found it after several years ruby programming.

Perhaps this is always the expected behavior?

i report here for check anyway

Actions

Also available in: Atom PDF

Like0
Like0Like0