SitePoint Sponsor

User Tag List

Results 1 to 16 of 16
  1. #1
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can,t use the @ sign in the ruby console mode

    Hello,

    as a ruby beginner i installed the application as mentioned in the new site point book and did go through the examples but i see that i can,t use the @ sign if i.m in the ruby console. In the windows console yes i can use the @ sign. I do not have a clue where the problem is.


    regards

    Stephen

  2. #2
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you post some examples of commands with the @ sign that you are trying to run in the Ruby console (which I assume is either irb or Rails' script/console)?

  3. #3
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    i post a screenshot of my system so i think it,s easier to see what is going on.


    regards

    Stephen
    Attached Images Attached Images

  4. #4
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I prefer the Ruby XMP filter over IRB. You can use this from Vim and Emacs. http://eigenclass.org/hiki.rb?xmpfilter Vim & Emacs will let you type @.

  5. #5
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just looks like your keyboard settings aren't right, or IRB isn't picking them up. Try Shift+".

  6. #6
    SitePoint Zealot daveporter's Avatar
    Join Date
    Mar 2002
    Location
    Perth, Western Australia
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi There,

    I seem to recall someone else had this problem and they had a French keyboard !

    Could this be a possible explanation ?

    There are alternatives to irb - just do the examples in a .rb file and run them from the command line - not as ellegant but functional !

    HTH - Dave Porter

  7. #7
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    no way to get this thing done it seems it is a failure in the instant rails installation because its strange i can use the @ sign under windows, but when i,m goinig into the rails app i can,t. I have a german keyboard but maybe if the app is in english this could be a cause ? Is there a tutorial to install the other editors mentioned above because i,m not really a rails wizard sorry.


    regards

    Stephen

  8. #8
    SitePoint Zealot daveporter's Avatar
    Join Date
    Mar 2002
    Location
    Perth, Western Australia
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Stephen,

    Are we still talking about irb now ?

    If so irb is not rails it is just a nice way of typing ruby code & getting instant results. I would just forget it and move on. Just use any editor you like and type the info into a file called test.rb, then run > ruby test.rb to run the file from a command prompt.

    cheers, Dave

  9. #9
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I disagree with that. One of the benefits of Ruby is that you're able to test every bit quickly. IRB helps you with this.

    But I encourage everyone to try out the XMP filter. It works like this:

    You type something into a file, for example:

    Code:
    10.times do |n|
      n * n                         # =>
    end
    When you run the filter (it can be integrated into good editors, so it's just one keypress):

    Code:
    10.times do |n|
      n * n                         # => 0, 1, 4, 9, 16, 25, 36, 49, 64, 81
    end
    You can very easily test code this way.

  10. #10
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    sorry for my ignorance but i think i don,t get the message. I maybe have to work on and so many stupit questions get lost on the way. That is the problem with the beginners because they not always know what for intance IRB means. I think it,s the open ruby windows console within instant rails ? I also typed in the code 10.times do |n|
    n * n # =>
    end
    and nothing happend the file called test.rb and i saved it to the www folder and also in the rails_apps folder and made > ruby test.rb but nothing happend. Maybe i learn some more babysteps and follow the book.

    regards

    Stephen

  11. #11
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    IRB means interactive ruby. It's a console, similar to the ordinary windows console/command line, but instead of typing windows commands (`dir` and `cd`) you type Ruby code. If you type `3 * 2` and press enter, IRB answers 6. You can launch it by opening a console/terminal and typing `irb`. Then type `4 + 2` and press enter.

    The XMP filter is different. Instead of typing Ruby code into a console you type it into a file. Then you add # => to every line you want to annotate. The filter adds the results of executing the code:

    3 * 2 # =>

    becomes:

    3 * 2 # => 6

    The XMP filter is not part of Ruby; you have to download it here: http://eigenclass.org/hiki.rb?xmpfilter

    You can use it via the command line: `xmpfilter yourfile.rb`. If you have "3 * 2 # =>" in this file you will see "3 * 2 # => 6". This is not very easy to use so you can integrate it into your editor. There are packages for Emacs and Vim. It shouldn't be too hard to add to your editor.

  12. #12
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    '@' on the german keyboard is entered with AltGr key, which irb doesn't seem to support. As to quick testing I prefer the sciTE editor which comes with windows ruby installer. Type your ruby code. Hit F5. Enjoy.

  13. #13
    SitePoint Member
    Join Date
    Feb 2007
    Location
    Antwerp, Belgium
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've had the same problem but I think I have found a workaround. Just go the Instant Rails console and click on the 'I'. Over there click on Help and choose fxri + irb console (see screendump). The irb console over there does accept [AltGr] key and therefore the @-symbol as you can see in the little code fragment. Hope this helps.
    Dan
    Attached Images Attached Images

  14. #14
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,


    thanks for the response i had some problems to get the message but now i know where to find "frixi" in my installation. On my instant rails app i have to start instant rails first and then right click on the red "I" in the lower right taskbar an then go to "Help/frixi - Ruby Interactive Help + irb Console and i can put the @ sign without problems. Now i will work on with the book examples and if everything works fine, i will make a additional post in the future to confirm that this suggested solution works in this thread. Further i have to say that i installed the instant rails app "InstantRails 1.3a.zip" recomended from Patrick Lenz on side 17 of his book "Build your own ruby on rails web applications". He said this is the prefered version because of backwards compatibility of the examples of the book as far as i remember. Anyway thanks for the efforts to get a solution for the problem to the community and Dan.


    best wishes

    Stephen

  15. #15
    SitePoint Member
    Join Date
    Jul 2007
    Location
    Oslo
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    irb and European keyboard solution

    "\M-[": "["
    "\M-]": "]"
    "\M-{": "{"
    "\M-}": "}"
    "\M-\\": "\\"
    "\M-|": "|"
    "\M-@": "@"
    "\M-~": "~"
    save above file as .inputrc in C:\Documents and Settings\<User>
    Enter Command prompt, then type: SET HOME=%HOMEPAGE%
    See http://wildmanshore.blogspot.com/200...board-and.html
    If you are adventurous see also: http://eigenclass.org/hiki/irb+ri+completion
    Both the fix and the fastri++ enhanced irb work together.

  16. #16
    SitePoint Member
    Join Date
    Jul 2007
    Location
    Oslo
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    irb and European keyboard solution

    "\M-[": "["
    "\M-]": "]"
    "\M-{": "{"
    "\M-}": "}"
    "\M-\\": "\\"
    "\M-|": "|"
    "\M-@": "@"
    "\M-~": "~"
    save above file as .inputrc in C:\Documents and Settings\<User>
    Enter Command prompt, then type: SET HOME=%HOMEPATH%
    See http://wildmanshore.blogspot.com/200...board-and.html
    If you are adventurous see also: http://eigenclass.org/hiki/irb+ri+completion
    Both the fix and the fastri++ enhanced irb work together.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •