Sha256: 213f14b9360ba9d3d2664f837f04fa8c9d87bd5eac52aca4eb2af11e26a8d348

Contents?: true

Size: 1.57 KB

Versions: 7

Compression:

Stored size: 1.57 KB

Contents

# Author::    Eric Crane  (mailto:eric.crane@mac.com)
# Copyright:: Copyright (c) 2020 Eric Crane.  All rights reserved.
#
# A Time object (does not include a date).
#

module Gloo
  module Objs
    class Time < Gloo::Core::Obj

      KEYWORD = 'time'.freeze
      KEYWORD_SHORT = 'time'.freeze

      #
      # The name of the object type.
      #
      def self.typename
        return KEYWORD
      end

      #
      # The short name of the object type.
      #
      def self.short_typename
        return KEYWORD_SHORT
      end

      # ---------------------------------------------------------------------
      #    Messages
      # ---------------------------------------------------------------------

      #
      # Get a list of message names that this object receives.
      #
      def self.messages
        return super + %w[now]
      end

      # Get the current working branch.
      def msg_now
        t = DateTime.now.strftime( '%I:%M:%S %P' )
        self.value = t
        $engine.heap.it.set_to t
      end

      # ---------------------------------------------------------------------
      #    Help
      # ---------------------------------------------------------------------

      #
      # Get help for this object type.
      #
      def self.help
        return <<~TEXT
          TIME OBJECT TYPE
            NAME: time
            SHORTCUT: time

          DESCRIPTION
            A reference to a time, but without a date.

          CHILDREN
            None

          MESSAGES
            now - Set to the current system time.
        TEXT
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gloo-0.6.1 lib/gloo/objs/dt/time.rb
gloo-0.6.0 lib/gloo/objs/dt/time.rb
gloo-0.5.4 lib/gloo/objs/dt/time.rb
gloo-0.5.3 lib/gloo/objs/dt/time.rb
gloo-0.5.2 lib/gloo/objs/dt/time.rb
gloo-0.5.1 lib/gloo/objs/dt/time.rb
gloo-0.5.0 lib/gloo/objs/dt/time.rb