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

Ruby – generate attr_accessor for ivars #17

Open
atg opened this issue Mar 18, 2016 · 1 comment
Open

Ruby – generate attr_accessor for ivars #17

atg opened this issue Mar 18, 2016 · 1 comment
Assignees

Comments

@atg
Copy link

atg commented Mar 18, 2016

Input

class Barney:
  def __init__(self):
    self.status = 'not ok'
barney = Barney()
barney.status = "ok"
print(barney.status)

Output

class Barney
  def initialize
    @status = 'not ok'
  end

end

barney = Barney.new
barney.status = 'ok'
puts barney.status

Error

undefined method status=' for #<Barney:0x007f837084d190 @status="not ok"> (NoMethodError)`

@alehander92
Copy link
Collaborator

  • add a AttrAccessMiddleware which analyzes the read/write access to an attribute
  • render attr_reader , attr_writer or attr_accessor based on the access field

@alehander92 alehander92 self-assigned this Mar 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants