From: Kouhei S. <ko...@co...> - 2014-10-22 12:38:38
|
> + alias_method :set_contrast_full_raw, :set_contrast_full > + def set_contrast(contrast_all_or_red, contrast_green=nil, contrast_blue=nil) It seems that we don't need the alias_method. > + unless contrast_green > + contrast = contrast_all_or_red > + else We don't use "unless ... else" for readability. Please use "if ... else". By the way, the code is buggy. The assignment just set local variable. :-) In <f2c...@je...> "[ruby-gnome2-cvs] ruby-gnome2/ruby-gnome2@f2c3b2f [master] clutter: add Clutter::BrightnessContrastEffect::*_full wrapper methods" on Wed, 22 Oct 2014 21:17:02 +0900, Hiroshi Hatake <nu...@co...> wrote: > Hiroshi Hatake 2014-10-22 21:17:02 +0900 (Wed, 22 Oct 2014) > > New Revision: f2c3b2fb405867023f6ff2858340e48d95f29afb > https://github.com/ruby-gnome2/ruby-gnome2/commit/f2c3b2fb405867023f6ff2858340e48d95f29afb > > Message: > clutter: add Clutter::BrightnessContrastEffect::*_full wrapper methods > > Added files: > clutter/lib/clutter/brightness-contrast-effect.rb > > Added: clutter/lib/clutter/brightness-contrast-effect.rb (+42 -0) 100644 > =================================================================== > --- /dev/null > +++ clutter/lib/clutter/brightness-contrast-effect.rb 2014-10-22 21:17:02 +0900 (bb0630b) > @@ -0,0 +1,42 @@ > +# Copyright (C) 2014 Ruby-GNOME2 Project Team > +# > +# This library is free software; you can redistribute it and/or > +# modify it under the terms of the GNU Lesser General Public > +# License as published by the Free Software Foundation; either > +# version 2.1 of the License, or (at your option) any later version. > +# > +# This library is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > +# Lesser General Public License for more details. > +# > +# You should have received a copy of the GNU Lesser General Public > +# License along with this library; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA > + > +module Clutter > + class BrightnessContrastEffect > + alias_method :set_contrast_full_raw, :set_contrast_full > + def set_contrast(contrast_all_or_red, contrast_green=nil, contrast_blue=nil) > + unless contrast_green > + contrast = contrast_all_or_red > + else > + contrast_red = contrast_all_or_red > + set_contrast_full_raw(contrast_red, contrast_green, > + contrast_blue) > + end > + end > + > + alias_method :set_brightness_full_raw, :set_brightness_full > + def set_brightness(brightness_all_or_red, brightness_green=nil, > + brightness_blue=nil) > + unless brightness_green > + brightness = brightness_all_or_red > + else > + brightness_red = brightness_all_or_red > + set_brightness_full_raw(brightness_red, brightness_green, > + brightness_blue) > + end > + end > + end > +end |