Sha256: d5661b6bf2ffc48f9ccb65a1bfd6b7b92d3204d7de4da9b45669a629bee857e4

Contents?: true

Size: 634 Bytes

Versions: 4

Compression:

Stored size: 634 Bytes

Contents

# Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.

module Wx

  module HTML

    class HtmlWindow

      # Need to override HtmlWindow.add_filter to provide cashing
      # for the added custom html filters to prevent premature GC
      class << self
        def html_filters
          @html_filters ||= []
        end
        private :html_filters

        wx_add_filter = instance_method(:add_filter)
        wx_redefine_method(:add_filter) do |filter|
          html_filters << filter
          wx_add_filter.bind(self).call(filter)
        end
      end

    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wxruby3-1.5.0 lib/wx/html/htmlwindow.rb
wxruby3-1.4.2 lib/wx/html/htmlwindow.rb
wxruby3-1.4.1 lib/wx/html/htmlwindow.rb
wxruby3-1.4.0 lib/wx/html/htmlwindow.rb