My preferred ruby style is (1) not to include parentheses when they are 
optional, and (2) not to pad them with extra spaces when they are used.

Bret

Chuck vdL wrote:
> Brett,
>
> ACK  I'm still at babysteps level of ruby coding and you're trying to
> turn me into a contributor aren't you ;)
>
> ok ok  I'll read up on patches and such and see if I can manage to
> submit something for this that doesn't totally screw up everything...
>
> this is how it starts isn't it.  how you rope people into working on
> open source stuff..  heh
>
>  just wait.. I told Maura that there's docs here in need of work, and
> since she's trying to move into doing more technical editing and
> such.. I just might be able to  convince her to do a few re-writes of
> things like the tutorial and such, to ah  you know, help her build up
> a portfolio of work  <muh hah hah  evil laugh and all that>
>
> Paul,
>
> thanks loads.   Where are you finding the documentation like that?  I
> was looking in the ruby user's guide and the most I could find so far
> in raise said that it took a single string parameter.. so I was
> scratching my head wondering how that code even worked at all.
>
> heh  OK  next error..
> Unexpected token - "number ="   form.rb  line 135, column 15
>
>  def flash number = 10
>
>  I'm starting to sense a pattern here...  their parser doesn't seem to
> be very good with the places that parenthesis are implied or optional
>
>  So re wrote it as :
>  def flash( number = 10 )    #is that the style you folks like in
> terms of where parethesis and spaces are place?)
>
> and that got me past  that one and into  element.rb,  line 238 column
> 15 with exact same error.. (same code, same fix)
>
> Next comes ie-class.rb   line 86  column 20
>
> def initialize suppress_new_window=nil
>   re-wrote as
> def initialize( suppress_new_window=nil )
>
> then  ie.class.rb  line 98  column 20
>
> def self.start url=nil
>    re-wrote as
> def self.start( url=nil )
>
> (bite me twice in same file, I start looking for more..  I find and
> change
>
> Line 104: def self.start_window url=nil
>   into: def self.start_window( url=nil )
>
> Line 129: def self.start_process url=nil
>   into: def self.start_process url=nil
>
> and....  WOOT  'library generation complete'
>
> but... grumble  intellisense is not working the way I'd expect..  ok
> I'm off to the sapphiresteel forums to ask them about this...
>
> Thanks for the help folks.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Dec 1, 11:59 am, "Paul Rogers" <[EMAIL PROTECTED]> wrote:
>   
>> the ri command ( ri Kernel#raise in this case ) shows
>> ---------------------------------------------------------- Kernel#raise
>>      raise
>>      raise(string)
>>      raise(exception [, string [, array]])
>>      fail
>>      fail(string)
>>      fail(exception [, string [, array]])
>> ------------------------------------------------------------------------
>>      With no arguments, raises the exception in +$!+ or raises a
>>      +RuntimeError+ if +$!+ is +nil+. With a single +String+ argument,
>>      raises a +RuntimeError+ with the string as a message. Otherwise,
>>      the first parameter should be the name of an +Exception+ class (or
>>      an object that returns an +Exception+ object when sent an
>>      +exception+ message). The optional second parameter sets the
>>      message associated with the exception, and the third parameter is
>>      an array of callback information. Exceptions are caught by the
>>      +rescue+ clause of +begin...end+ blocks.
>>
>>         raise "Failed to create socket"
>>         raise ArgumentError, "No parameters", caller
>>
>> which menas you could do as you describe - add brackets round it all.
>>
>> To submit a patch, open a jira ticket and do a diff of what you have
>> compared to the current svn
>> Im sure how to do that is described on the wiki or in this list
>>
>> Paul
>>
>>
>>
>> On Mon, Dec 1, 2008 at 12:55 PM, Chuck vdL <[EMAIL PROTECTED]> wrote:
>>
>>     
>>> OK the putting that in 'brackets'  (sorry still think of those as
>>> parenthesis, and [] as brackets..)  eliminated that error and got me a
>>> new one..  (heh  isn't this fun)
>>>       
>>> Now the problem is on line 1078 column 39 of firefox.rb    another
>>> unexpected token, this time a comma..
>>>       
>>> So I went and looked, here's the code in that area
>>>       
>>> --=-=-=-=- snip -=-=-=-=
>>>   # 5/16/08 Derek Berner
>>>    # Wrapper method to send JS commands concisely,
>>>    # and propagate errors
>>>    def js_eval(str)
>>>      #puts "JS Eval: #{str}"
>>>      $jssh_socket.send("#{str};\n",0)
>>>      value = read_socket()
>>>      if md=/^(\w+)Error:(.*)$/.match(value)
>>>        eval "class JS#{md[1]}Error\nend"
>>>        raise (eval "JS#{md[1]}Error"), md[2]
>>>      end
>>>      #puts "Value: #{value}"
>>>      value
>>>    end
>>> --=-=-=-=-=- snip -=-=-=-
>>>       
>>> The problem is on the 'raise' line, it doesn't like the comma after
>>> the closing backet, before  "md[2]"   any ideas?  do I need to wrap
>>> everything after 'raise' in another set of brackets?    so it reads
>>> like
>>>       
>>>        raise ((eval "JS#{md[1]}Error"), md[2])
>>>       
>>> ??
>>>       
>>>  (and if these things get stuff working, do I need to raise a jira
>>> issue for this so we make sure to make these changes in the watir
>>> source?  (point me at instructions for this if they exist, so I do it
>>> 'right'  I'm used to using Jira at work, but in my experience every
>>> group has their own standards for how they want bugs filed)
>>>       
>>> On Dec 1, 11:12 am, "Paul Rogers" <[EMAIL PROTECTED]> wrote:
>>>       
>>>> try changing it to
>>>>         
>>>> def initialize( *args )
>>>>         
>>>> the * means that it takes a variable number of parameters as an niput
>>>> to the method, I think youd use it like this
>>>>         
>>>> def my_method( *args )
>>>>         
>>>>     if args.length ==2
>>>>         puts "arg[0] is " + arg[0]
>>>>     else
>>>>         puts "you didnt supply 2 args"
>>>>     end
>>>>         
>>>> end
>>>>         
>>>> my_method( 2,3)     # produces arg[0] is 2
>>>> my_method( 4,5,6)  # produces you didnt supply 2 args
>>>>         
>>>> Paul
>>>>         
>>>> On Mon, Dec 1, 2008 at 12:09 PM, Chuck vdL <[EMAIL PROTECTED]> wrote:
>>>>         
>>>>> OK so I went and looked..  it's not javascript
>>>>>           
>>>>> -=-=- snip-=-=
>>>>> class Radio < RadioCheckCommon
>>>>>  def initialize *args
>>>>>           
>>>>> =-=-=-= snip =-=-=-=
>>>>>           
>>>>> its the *  in *args  that's giving it a fit..   Now understand please
>>>>> that my ruby coding skills are in their infancy..  and I've not gotten
>>>>> into defining my own classes or subclassing or any of that.. so I've
>>>>> no idea (other than it looks something like a C++ pointer, but I know
>>>>> ruby doesn't have pointers) what in the world *args  is doing at that
>>>>> point in the code..
>>>>>           
>>>>> Is this valid ruby code and I'm perhaps looking at a bug in ruby in
>>>>> steel?    Is this something added really recently to ruby?  RiS comes
>>>>> with ruby 186-25  (although I thought I updated this)
>>>>>           
>>>>> ruby-v reports   "1.8.6  (2007-09-24 patchlevel 111)"
>>>>>  that should be the correct version for working with Watir 1.6.2
>>>>> right?
>>>>>           
>>>>> On Dec 1, 10:32 am, "Paul Rogers" <[EMAIL PROTECTED]> wrote:
>>>>>           
>>>>>> heres my guess - the firewatir code uses lots of whats really
>>>>>> javascript embedded in the ruby file. I think the parser is having  a
>>>>>> hard time figuring out whats ruby and whats javascript
>>>>>>             
>>>>>> If you poke around in the lines suggested by the parser, you might be
>>>>>> able rearrange some of the code to better help the parser
>>>>>>             
>>>>>> Paul
>>>>>>             
>>>>>> On Mon, Dec 1, 2008 at 11:16 AM, Chuck vdL <[EMAIL PROTECTED]> wrote:
>>>>>>             
>>>>>>> I'm having a look at Ruby in Steel as a potential IDE for doing
>>>>>>> testing automation with Watir.
>>>>>>>  <http://www.sapphiresteel.com/>
>>>>>>>               
>>>>>>> Mostly because:
>>>>>>>  1) all my devs use Visual Studio for their work, so it puts me on the
>>>>>>> same platform, gives me good integration with our source control etc.
>>>>>>>  2) Intellisense!!!   since I'm new to Watir and have not memorized
>>>>>>> all the applicable methods for each object etc.. and also new to
>>>>>>> ruby.  Well it just makes it a hell of a lot easier.
>>>>>>>  3) awsome debugger
>>>>>>>               
>>>>>>> Firstly:  Has anyone else looked at this?  Does anyone else use it?
>>>>>>>               
>>>>>>> I could only find one reference here when searching this group.
>>>>>>>               
>>>>>>> Secondly, I'm having a problem:  It appears to get Intellisense
>>>>>>> working, I have to add the watir code using their 'ruby librarian'
>>>>>>> utility.. so I pointed it at the various lib directories under c\ruby
>>>>>>> \lib\ruby\gems\1.8\gems   for commonwatir, firewatir, watir and asked
>>>>>>> it to add all the .rb files found there.
>>>>>>>               
>>>>>>> In the process it gives me the following error
>>>>>>> "unexpected token - '*'   htmlelements.rb  Line 1563  column 20  "
>>>>>>>               
>>>>>>>  the file appears to be part of Firewatir.  Anyone here have an idea
>>>>>>> why it might be giving me that message?- Hide quoted text -
>>>>>>>               
>>>>>> - Show quoted text -- Hide quoted text -
>>>>>>             
>>>> - Show quoted text -- Hide quoted text -
>>>>         
>> - Show quoted text -
>>     
> >
>   


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to