Динамические переменные класса



#!/usr/bin/ruby

class FirstClass
public
    def f1()
    end

private
    def f2()
    end

protected
    def f3()
    end
end

class SecondClass
    def f1()
    end

    def f2()
    end

    def f3()
    end

    def f4()
    end

    public :f1, :f2
    private :f3
    protected :f4
end


class ThirdClass

    attr_reader :aa
    attr_writer :bb
    attr :cc, true    # reader & writer
    attr_accessor :dd # read & writer

    public :aa;
    private :bb=;     # Внимание!
    protected :cc;

end

a = FirstClass.new
b = SecondClass.new
c = ThirdClass.new