On Thu, Aug 13, 2009 at 09:31:29PM +0200, Klaus Kaempf wrote:
> * Ladislav Slezak <[email protected]> [Aug 13. 2009 19:04]:
> > + if ENV['RAILS_ENV'] == 'production'
> > + Rails.logger.debug 'Rebooting the computer...'
> > + return computer.Reboot == 0
>
> 'Reboot' seems to be a function. However according to Ruby naming
> conventions 'Reboot' is a class (first letter upper case).
>
> > + else
> > + Rails.logger.debug "Skipping reboot in
> > #{ENV['RAILS_ENV']} mode"
> > + return true
> > + end
>
> The result of the "when :reboot" case is of boolean type. Let the
> 'reboot' function also return a boolean and drop the comparison with 0
These are valid points, but "computer" is a HAL object (via DBus):
computer = hal_service.object('/org/freedesktop/Hal/devices/computer')
http://git.opensuse.org/?p=projects/yast/rest-service.git;a=blob;f=plugins/system/app/models/system.rb;h=079c635ad091234f6f74e91116d435bf97ba0e1f;hb=61a05cdc92bbadef1248298cea49ebd3f98979ed
- The methods return "Int32 return_code". Not worth wrapping to a
boolean, I think.
- Converting method names from ruby_style to DbusStyle could work.
Should I look into it?
--
Martin Vidner, YaST developer
http://en.opensuse.org/User:Mvidner
Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]