pseudo
pseudo copied to clipboard
Ruby – generate attr_accessor for ivars
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)`
- [ ] add a AttrAccessMiddleware which analyzes the read/write access to an attribute
- [ ] render
attr_reader
,attr_writer
orattr_accessor
based on the access field