chingu icon indicating copy to clipboard operation
chingu copied to clipboard

reducing the amount of written code for helpers that delegate methods to other objects

Open erisdev opened this issue 13 years ago • 0 comments

I've made use of Ruby's Forwardable module to shorten delegate methods to a single line each. Thus:

def add_game_object(object)
  @game_objects.add_game_object(object)
end

becomes

def_delegator :@game_objects, :add_game_object

Also extracted the duplicated FPS counter code from Window and Console into a new helper module.

erisdev avatar Feb 28 '11 00:02 erisdev