ashbb / green_shoes

Green Shoes is one of the colorful Shoes written in pure Ruby.
Other
204 stars 37 forks source link

Image method cannot be provided no parameters #89

Open matgrioni opened 7 years ago

matgrioni commented 7 years ago

Below is the current implementation of the Image class. This does not allow for an image widget to be created with no specified path, which is quite useful when you are creating the layout but do not yet know which image you are to load.

class Image < Basic
    def initialize args
      @path = args[:path]
      args.delete :path
      super args      
    end

    def path=(name)
      @path = name
      @real.clear
      args = {width: @width, height: @height, noorder: true}
      args.merge!({hidden: true}) if @hided
      @real = @app.image(name, args).move(@left, @top).real.tap{@app.flush}
    end
    ...
end