pseudo-lang / pseudo

transpile algorithms/libs to idiomatic JS, Go, C#, Ruby
MIT License
686 stars 43 forks source link

Ruby – generate attr_accessor for ivars #17

Open atg opened 8 years ago

atg commented 8 years ago

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 methodstatus=' for #<Barney:0x007f837084d190 @status="not ok"> (NoMethodError)`

alehander92 commented 8 years ago