Sha256: a8103dc3bcf64bf310e0b08c18043c6ea9bd0153591bbf523db55b14a164f2dd
Contents?: true
Size: 1.46 KB
Versions: 4
Compression:
Stored size: 1.46 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 GlooLang module Objs class Time < GlooLang::Core::Obj KEYWORD = 'time'.freeze KEYWORD_SHORT = 'time'.freeze DEFAULT_FORMAT = '%I:%M:%S %P'.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 # # Set the value with any necessary type conversions. # def set_value( new_value ) if DtTools.is_dt_type? new_value self.value = new_value else self.value = @engine.converter.convert( new_value, 'Time', nil ) end if DtTools.is_dt_type? self.value self.value = self.value.strftime( DEFAULT_FORMAT ) end 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 self.set_value( DateTime.now ) @engine.heap.it.set_to self.value end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
gloo-lang-1.4.3 | lib/gloo_lang/objs/dt/time.rb |
gloo-lang-1.4.2 | lib/gloo_lang/objs/dt/time.rb |
gloo-lang-1.4.1 | lib/gloo_lang/objs/dt/time.rb |
gloo-lang-1.4.0 | lib/gloo_lang/objs/dt/time.rb |