Sha256: 39c8323181e865028c7879a8ae7f50d490ba37364d0e1b3810dd328d370cddb1

Contents?: true

Size: 444 Bytes

Versions: 4

Compression:

Stored size: 444 Bytes

Contents

module Nuklear
  module UI
    class OptionGroup < Base
      include Nuklear::UI::Container

      def initialize(**options)
        super(**options)
        @options = []
      end

      def selection=(selected)
        @options.each { |option| option.selected = (option == selected) }
      end

      def <<(other)
        super other
        @options << other
        other.on(true) { self.selection = other }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nuklear-0.1.3 lib/nuklear/ui/option_group.rb
nuklear-0.1.2 lib/nuklear/ui/option_group.rb
nuklear-0.1.1 lib/nuklear/ui/option_group.rb
nuklear-0.1.0 lib/nuklear/ui/option_group.rb