Sha256: 7b8ace5c620048e986f969d60eb215393a2eee1014dd1b2fae07966bb9c31d33

Contents?: true

Size: 794 Bytes

Versions: 1

Compression:

Stored size: 794 Bytes

Contents

class Shoes
  module Common
    module Visibility
      # Hides the element, so that it can't be seen. See also #show and #toggle.
      def hide
        @hidden = true
        update_visibility
      end

      def hidden?
        @hidden
      end

      alias_method :hidden, :hidden?

      def visible?
        !hidden?
      end

      # Reveals the element, if it is hidden. See also #hide and #toggle.
      def show
        @hidden = false
        update_visibility
      end

      # Hides an element if it is shown. Or shows the element, if it is hidden.
      # See also #hide and #show.
      def toggle
        @hidden = !@hidden
        update_visibility
      end

      private
      def update_visibility
        gui.update_visibility
        self
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoes-dsl-4.0.0.pre2 lib/shoes/common/visibility.rb