Hi All, I want to create a console application using ruby. Can you please provide me the details/idea? Lots of thanks, Priya -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 27 January 2011 04:48, Priya D. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi All, > > I want to create a console application using ruby. Can you please > provide me the details/idea?That is nothing to do with RoR of course, but just write a file.rb run it by ruby file.rb You can use puts etc to access the console. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I want to create a new console using ruby code. From the new console, i''ll execute my commands. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 27 January 2011 09:20, Priya D. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I want to create a new console using ruby code. From the new console, > i''ll execute my commands.What do you mean by create a new console? Please describe in more detail what you are trying to do. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I''m creating a new object for a class using irb. At that time, if the object is created successfully, a new console should be open. The newly opened console should act as the created object. so that i can execute all the instance methods through the newly opened console, without prefixing object to the methods. am i clear? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 27 January 2011 09:31, Priya D. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I''m creating a new object for a class using irb. At that time, if the > object is created successfully, a new console should be open. The newly > opened console should act as the created object. > > so that i can execute all the instance methods through the newly opened > console, without prefixing object to the methods.You can use the ruby method ''system'' to run system commands to open a command shell if that is what you mean. Colin> > am i clear? > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No Colin, i don''t want to execute system commands. For eg, 1) I''m requiring a gem in console.(require "somegem") 2) I''ll create object of the gem. (@obj = Module::Class.new) 3) Using the created object, i''ll access the methods in the gem. (@obj.get_details()) In the above mentioned steps, while i''m creating a object, a new console should open, which represents the object. I just give the instance method names in the opened console.i.e, get_details() instead of @obj.get_details(). Is this making sense? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 27 January 2011 09:47, Priya D. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> No Colin, i don''t want to execute system commands. > > For eg, > > 1) I''m requiring a gem in console.(require "somegem") > 2) I''ll create object of the gem. (@obj = Module::Class.new) > 3) Using the created object, i''ll access the methods in the gem. > (@obj.get_details()) > > In the above mentioned steps, while i''m creating a object, a new console > should open, which represents the object. > > I just give the instance method names in the opened console.i.e, > get_details() instead of @obj.get_details(). > > Is this making sense?Which OS are you running (Ubuntu, XP etc)? How do you open the first console? Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Am using Ubuntu 10.04. Just using irb. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 27 January 2011 11:04, Priya D. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Am using Ubuntu 10.04. Just using irb.Please don''t top post, it makes it difficult to follow the thread, insert your reply into the previous post, thanks. So to open a console you open a terminal window and then run irb. If you want to open another console then AFAIK you will need to run a system command to open another terminal and run irb. Something like system( ''gnome-terminal -e irb'') Unless someone knows another way. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law wrote in post #977860:> On 27 January 2011 11:04, Priya D. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> Am using Ubuntu 10.04. Just using irb. > > Please don''t top post, it makes it difficult to follow the thread, > insert your reply into the previous post, thanks. > > So to open a console you open a terminal window and then run irb. If > you want to open another console then AFAIK you will need to run a > system command to open another terminal and run irb. Something like > system( ''gnome-terminal -e irb'') > Unless someone knows another way. > > ColinSorry Colin, i think you didn''t get my requirement. Thank you very much for your valuable effort. Anyway, i''m working on this. If i get the solution, i''ll reply. Thanks. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I think you can use Irb to jump into another object : http://www.ruby-forum.com/topic/182335 http://errtheblog.com/posts/24-irb-mix-tape (3rd paragraph) Here is something that I created for myself to have capybara console: It creates and object, extends it with the capybara api and jumps into it. https://gist.github.com/798979 I couldn''t find an easier way to jump into an object with irb at the beginning of the session. I hope this will help. Robert Pankowecki -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Thu, Jan 27, 2011 at 2:31 AM, Priya D. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I''m creating a new object for a class using irb. At that time, if the > object is created successfully, a new console should be open. The newly > opened console should act as the created object. > > so that i can execute all the instance methods through the newly opened > console, without prefixing object to the methods. > > am i clear? > >The concept of nested irb shells is already supported by irb. You merely have to use the method "irb <instance>" while in irb to insert yourself into the instance''s namespace. irb(main):001:0> class Test irb(main):002:1> def test_method irb(main):003:2> "test method called correctly" irb(main):004:2> end irb(main):005:1> end => nil irb(main):006:0> irb Test.new irb#1(#<Test:0x1c67478>):001:0> test_method => "test method called correctly" irb#1(#<Test:0x1c67478>):002:0> quit => #<IRB::Irb: @scanner=#<RubyLex:0x1bac510>, @context=#<IRB::Context:0x1bacbc8>, @signal_status=:IN_EVAL> irb(main):007:0> quit bash% Josh -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.