Class: GlooLang::Objs::Container

Inherits:
Core::Obj show all
Defined in:
lib/gloo_lang/objs/basic/container.rb

Constant Summary collapse

KEYWORD =
'container'.freeze
KEYWORD_SHORT =
'can'.freeze

Constants inherited from Core::Baseo

Core::Baseo::NOT_IMPLEMENTED_ERR

Instance Attribute Summary

Attributes inherited from Core::Obj

#children, #parent, #value

Attributes inherited from Core::Baseo

#name

Class Method Summary collapse

Instance Method Summary collapse

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_reload, #msg_unload, #multiline_value?, #pn, #remove_child, #root?, #send_message, #set_parent, #set_value, #type_display, #value_display, #value_is_array?, #value_is_blank?, #value_string?

Methods inherited from Core::Baseo

#initialize, #type_display

Constructor Details

This class inherits a constructor from GlooLang::Core::Obj

Class Method Details

.messagesObject

Get a list of message names that this object receives.



35
36
37
# File 'lib/gloo_lang/objs/basic/container.rb', line 35

def self.messages
  return super + %w[count delete_children show_key_value_table]
end

.short_typenameObject

The short name of the object type.



24
25
26
# File 'lib/gloo_lang/objs/basic/container.rb', line 24

def self.short_typename
  return KEYWORD_SHORT
end

.typenameObject

The name of the object type.



17
18
19
# File 'lib/gloo_lang/objs/basic/container.rb', line 17

def self.typename
  return KEYWORD
end

Instance Method Details

#msg_countObject

Count the number of children in the container.



42
43
44
45
46
# File 'lib/gloo_lang/objs/basic/container.rb', line 42

def msg_count
  i = child_count
  @engine.heap.it.set_to i
  return i
end

#msg_delete_childrenObject

Delete all children in the container.



51
52
53
# File 'lib/gloo_lang/objs/basic/container.rb', line 51

def msg_delete_children
  self.delete_children
end

#msg_show_key_value_tableObject

Show the given table data.



58
59
60
61
# File 'lib/gloo_lang/objs/basic/container.rb', line 58

def msg_show_key_value_table
  data = self.children.map { |o| [ o.name, o.value ] }
  @engine.platform.show_table nil, data, title
end