Class: GlooLang::Objs::String

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

Constant Summary collapse

KEYWORD =
'string'.freeze
KEYWORD_SHORT =
'str'.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, #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.



42
43
44
# File 'lib/gloo_lang/objs/basic/string.rb', line 42

def self.messages
  return super + %w[up down size]
end

.short_typenameObject

The short name of the object type.



24
25
26
# File 'lib/gloo_lang/objs/basic/string.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/string.rb', line 17

def self.typename
  return KEYWORD
end

Instance Method Details

#msg_downObject

Convert string to lower case



68
69
70
71
72
73
# File 'lib/gloo_lang/objs/basic/string.rb', line 68

def msg_down
  s = value.downcase
  set_value s
  @engine.heap.it.set_to s
  return s
end

#msg_sizeObject

Get the size of the string.



49
50
51
52
53
# File 'lib/gloo_lang/objs/basic/string.rb', line 49

def msg_size
  s = value.size
  @engine.heap.it.set_to s
  return s
end

#msg_upObject

Convert string to upper case



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

def msg_up
  s = value.upcase
  set_value s
  @engine.heap.it.set_to s
  return s
end

#set_value(new_value) ⇒ Object

Set the value with any necessary type conversions.



31
32
33
# File 'lib/gloo_lang/objs/basic/string.rb', line 31

def set_value( new_value )
  self.value = new_value.to_s
end