Sha256: ab65c79ee5969926b1e1cb7551e57f799fa7a2a32fce7cb028afad6f83cdb0ef

Contents?: true

Size: 1.04 KB

Versions: 9

Compression:

Stored size: 1.04 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

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

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gloo-0.8.0 lib/gloo/objs/dt/time.rb
gloo-0.7.7 lib/gloo/objs/dt/time.rb
gloo-0.7.6 lib/gloo/objs/dt/time.rb
gloo-0.7.5 lib/gloo/objs/dt/time.rb
gloo-0.7.4 lib/gloo/objs/dt/time.rb
gloo-0.7.3 lib/gloo/objs/dt/time.rb
gloo-0.7.2 lib/gloo/objs/dt/time.rb
gloo-0.7.1 lib/gloo/objs/dt/time.rb
gloo-0.7.0 lib/gloo/objs/dt/time.rb