Class: Gloo::Objs::Datetime
- Inherits:
-
Core::Obj
- Object
- Core::Baseo
- Core::Obj
- Gloo::Objs::Datetime
- Defined in:
- lib/gloo/objs/dt/datetime.rb
Constant Summary collapse
- KEYWORD =
'datetime'.freeze
- KEYWORD_SHORT =
'dt'.freeze
Instance Attribute Summary
Attributes inherited from Core::Obj
Attributes inherited from Core::Baseo
Class Method Summary collapse
-
.messages ⇒ Object
Get a list of message names that this object receives.
-
.short_typename ⇒ Object
The short name of the object type.
-
.typename ⇒ Object
The name of the object type.
Instance Method Summary collapse
-
#msg_now ⇒ Object
Set to the current date and time.
-
#set_value(new_value) ⇒ Object
Set the value with any necessary type conversions.
Methods inherited from Core::Obj
#add_child, #add_children_on_create?, #add_default_children, can_create?, #can_receive_message?, #child_count, #contains_child?, #delete_children, #dispatch, #display_value, #find_add_child, #find_child, help, inherited, #initialize, #msg_unload, #multiline_value?, #pn, #remove_child, #root?, #send_message, #set_parent, #type_display, #value_display, #value_is_array?, #value_is_blank?, #value_string?
Methods inherited from Core::Baseo
Constructor Details
This class inherits a constructor from Gloo::Core::Obj
Class Method Details
.messages ⇒ Object
Get a list of message names that this object receives.
47 48 49 |
# File 'lib/gloo/objs/dt/datetime.rb', line 47 def self. return super + %w[now] end |
.short_typename ⇒ Object
The short name of the object type.
24 25 26 |
# File 'lib/gloo/objs/dt/datetime.rb', line 24 def self.short_typename return KEYWORD_SHORT end |
.typename ⇒ Object
The name of the object type.
17 18 19 |
# File 'lib/gloo/objs/dt/datetime.rb', line 17 def self.typename return KEYWORD end |
Instance Method Details
#msg_now ⇒ Object
Set to the current date and time.
54 55 56 57 58 |
# File 'lib/gloo/objs/dt/datetime.rb', line 54 def msg_now t = DateTime.now.strftime( '%Y.%m.%d %I:%M:%S %P' ) self.value = t $engine.heap.it.set_to t end |
#set_value(new_value) ⇒ Object
Set the value with any necessary type conversions.
31 32 33 34 35 36 37 38 |
# File 'lib/gloo/objs/dt/datetime.rb', line 31 def set_value( new_value ) unless new_value.is_a? DateTime self.value = $engine.converter.convert( new_value, 'DateTime', nil ) return end self.value = new_value end |