Sha256: 351fd0d313cb38e6bf94f37108d103641019d9ff00c861ac348be566c5199fa0

Contents?: true

Size: 1.7 KB

Versions: 25

Compression:

Stored size: 1.7 KB

Contents

module Vedeu

  module Cursors

    # Control the visibility of the cursor for each interface/view.
    #
    module DSL

      # Set the cursor visibility on an interface.
      #
      # @param value [Boolean] Any value other than nil or false will
      #   evaluate
      #   to true.
      #
      # @example
      #   Vedeu.interface :my_interface do
      #     cursor  true  # => show the cursor for this interface
      #     # or...
      #     cursor  :show # => both of these are equivalent to line
      #                   #    above
      #     # or...
      #     cursor!       #
      #     # ...
      #   end
      #
      #   Vedeu.interface :my_interface do
      #     cursor false # => hide the cursor for this interface
      #     # or...
      #     cursor nil   # => as above
      #     # ...
      #   end
      #
      #   Vedeu.view :my_interface do
      #     cursor true # => Specify the visibility of the cursor when
      #                 #    the view is rendered.
      #     # ...
      #   end
      #
      # @return [Vedeu::Cursors::Cursor]
      def cursor(value = true)
        boolean = value ? true : false

        model.cursor_visible = boolean

        Vedeu::Cursors::Cursor.store(name: model.name, visible: boolean)
      end

      # Set the cursor to visible for the interface or view.
      #
      # @return [Vedeu::Cursors::Cursor]
      def cursor!
        cursor(true)
      end
      alias_method :show_cursor!, :cursor!

      # Set the cursor to invisible for the interface or view.
      #
      # @return [Vedeu::Cursors::Cursor]
      def no_cursor!
        cursor(false)
      end
      alias_method :hide_cursor!, :no_cursor!

    end # DSL

  end # Cursors

end # Vedeu

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
vedeu-0.6.68 lib/vedeu/cursors/dsl.rb
vedeu-0.6.67 lib/vedeu/cursors/dsl.rb
vedeu-0.6.66 lib/vedeu/cursors/dsl.rb
vedeu-0.6.65 lib/vedeu/cursors/dsl.rb
vedeu-0.6.64 lib/vedeu/cursors/dsl.rb
vedeu-0.6.63 lib/vedeu/cursors/dsl.rb
vedeu-0.6.62 lib/vedeu/cursors/dsl.rb
vedeu-0.6.61 lib/vedeu/cursors/dsl.rb
vedeu-0.6.60 lib/vedeu/cursors/dsl.rb
vedeu-0.6.59 lib/vedeu/cursors/dsl.rb
vedeu-0.6.58 lib/vedeu/cursors/dsl.rb
vedeu-0.6.57 lib/vedeu/cursors/dsl.rb
vedeu-0.6.56 lib/vedeu/cursors/dsl.rb
vedeu-0.6.54 lib/vedeu/cursors/dsl.rb
vedeu-0.6.53 lib/vedeu/cursors/dsl.rb
vedeu-0.6.52 lib/vedeu/cursors/dsl.rb
vedeu-0.6.51 lib/vedeu/cursors/dsl.rb
vedeu-0.6.50 lib/vedeu/cursors/dsl.rb
vedeu-0.6.49 lib/vedeu/cursors/dsl.rb
vedeu-0.6.48 lib/vedeu/cursors/dsl.rb