Project

General

Profile

Actions

Feature #19898

open

Special syntax for instance variable assignment

Added by x3qt (Jury Paliakou) about 1 year ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:114881]

Description

Since keyword arg assignment is already DRY with omitting of argument of the same name, what about DRYing out an instance var assignment? Something like this, with "@" for example, since it's already used to assign instance vars / memoize

def initialize(payload)
  @payload = payload
end

def abc(d)
  @d = d
end

# to be have a short from of

def initialize(@payload)
end

def abc(@d)
end

Related issues 1 (1 open0 closed)

Is duplicate of Ruby master - Feature #5825: Sweet instance var assignment in the object initializerAssignedmatz (Yukihiro Matsumoto)Actions
Actions

Also available in: Atom PDF

Like0
Like0