Comment

Comment by effbott

Ruby really is a great language. The author just posted a poor example that is frankly NOT idiomatic Ruby. The proper way to create a getter and setter method on an instance variable is like so:

  class Person
    attr_accessor :sanity

    def initialize
      @sanity = 50
    end
  end
parent effbott 13 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton