• making a class in irb

    From Sidney Reilley@21:1/5 to All on Fri Nov 19 17:37:59 2021
    Ruby noob here! Using irb to learn.
    created a sample class with 2 instance vars.
    tried to access the vars. NO JOY!
    Forgot to include the attr_reader.
    Is there a way to amend/update a class in the irb?
    Or do I have to re-type the entire class over again?
    TIA ...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From BeeRich33@21:1/5 to Sidney Reilley on Sat Nov 20 11:39:17 2021
    On Friday, November 19, 2021 at 12:38:06 PM UTC-5, Sidney Reilley wrote:
    Ruby noob here! Using irb to learn.

    Best to use a different environment.

    - install the filewatcher gem
    - create a test file named app.rb with proper ruby headers at the top
    - create an alias in your .bash_profile like this:

    kk='filewatcher "/users/sidney/app.rb" "clear; ruby /users/sidney/app.rb"'

    in the terminal, type kk, and it will be running. When you edit the file and save it, it will run in the terminal. This is a much better option than irb.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sidney Reilley@21:1/5 to beerich@gmail.com on Sat Nov 20 21:24:30 2021
    On Sat, 20 Nov 2021 11:39:17 -0800 (PST)
    BeeRich33 <beerich@gmail.com> wrote:

    On Friday, November 19, 2021 at 12:38:06 PM UTC-5, Sidney Reilley
    wrote:
    Ruby noob here! Using irb to learn.

    Best to use a different environment.

    - install the filewatcher gem
    - create a test file named app.rb with proper ruby headers at the
    top
    - create an alias in your .bash_profile like this:

    kk='filewatcher "/users/sidney/app.rb" "clear;
    ruby /users/sidney/app.rb"'

    in the terminal, type kk, and it will be running. When you edit
    the file and save it, it will run in the terminal. This is a
    much better option than irb.

    Good stuff! Thx for heads up for this useful solution.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)