Sha256: 693c9f6bd5ae694ae10bdbddc38895681dd076a4c3e1a0ba7e26cbd2d51ae23d

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 Date object (does not include a time).
#

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

      KEYWORD = 'date'.freeze
      KEYWORD_SHORT = 'date'.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( '%Y.%m.%d' )
        self.value = t
        $engine.heap.it.set_to t
      end

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

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

          DESCRIPTION
            A reference to a date, but without time.

          CHILDREN
            None

          MESSAGES
            now - Set to the current system date.
        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/date.rb
gloo-0.6.0 lib/gloo/objs/dt/date.rb
gloo-0.5.4 lib/gloo/objs/dt/date.rb
gloo-0.5.3 lib/gloo/objs/dt/date.rb
gloo-0.5.2 lib/gloo/objs/dt/date.rb
gloo-0.5.1 lib/gloo/objs/dt/date.rb
gloo-0.5.0 lib/gloo/objs/dt/date.rb