Sha256: ffce4bc6f9b3ff3190bbb429300c71be61cbc2b7363afadaf590515235af8379

Contents?: true

Size: 496 Bytes

Versions: 2

Compression:

Stored size: 496 Bytes

Contents

class Shoes
  module Common
    module State
      DISABLED_STATE = "disabled".freeze

      def after_initialize(*_)
        super
        update_enabled
      end

      def state=(value)
        style(state: value)
        update_enabled
      end

      def state_options(opts)
        self.state = opts[:state]
      end

      private

      def enabled?
        !(state.to_s == DISABLED_STATE)
      end

      def update_enabled
        @gui.enabled(enabled?)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shoes-core-4.0.0.pre8 lib/shoes/common/state.rb
shoes-core-4.0.0.pre7 lib/shoes/common/state.rb