Class: Gloo::Objs::String

Inherits:
Core::Obj show all
Includes:
StringMsgs
Defined in:
lib/gloo/objs/basic/string.rb

Constant Summary collapse

KEYWORD =
'string'.freeze
KEYWORD_SHORT =
'str'.freeze
MISSING_PARAM_MSG =
'Missing parameter!'.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 included from StringMsgs

message_docs, #msg_count_chars, #msg_count_lines, #msg_count_words, #msg_decode64, #msg_down, #msg_encode64, #msg_ends_with?, #msg_escape, #msg_format_for_html, #msg_gen_alphanumeric, #msg_gen_base64, #msg_gen_hex, #msg_gen_uuid, #msg_gsub, #msg_page, #msg_size, #msg_split, #msg_split_list, #msg_splitl, #msg_splitr, #msg_starts_with?, #msg_sub, #msg_substring?, #msg_trim, #msg_unescape, #msg_up

Methods inherited from Core::Obj

#add_child, #add_children_on_create?, #add_default_children, can_create?, #can_receive_message?, #child_count, #child_index, #contains_child?, #delete_children, #dispatch, #display_value, #find_add_child, #find_child, #find_child_resolve_alias, #find_child_value, help, inherited, #initialize, #is_alias?, #is_container?, #is_function?, #msg_blank?, #msg_contains?, #msg_reload, #msg_responds_to?, #msg_unload, #multiline_value?, #pn, #remove_child, #render, #root?, #send_message, #set_parent, #sql_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 Gloo::Core::Obj

Class Method Details

.doc_dataObject

Get the object's documentation data.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/gloo/objs/basic/string.rb', line 57

def self.doc_data
  {
    :name => KEYWORD,
    :shortcut => KEYWORD_SHORT,
    :description => 'A string value. For string interpolation, ' \
      'see the erb object type. Shares the same messages as the ' \
      'text object type; the two differ mainly by convention — ' \
      'string for a single word or line, text for longer, ' \
      'multi-line blocks.',
    :messages => StringMsgs.message_docs,
    :examples => <<~EXAMPLES.strip
      s [can] :
        msg [string] : Hello World!
        on_load [script] :
          show s.msg
          tell s.msg to up
          show s.msg
          tell s.msg to size
          show it
    EXAMPLES
  }
end

.messagesObject

Get a list of message names that this object receives.



46
47
48
# File 'lib/gloo/objs/basic/string.rb', line 46

def self.messages
  return super + StringMsgs.messages
end

.short_typenameObject

The short name of the object type.



28
29
30
# File 'lib/gloo/objs/basic/string.rb', line 28

def self.short_typename
  return KEYWORD_SHORT
end

.typenameObject

The name of the object type.



21
22
23
# File 'lib/gloo/objs/basic/string.rb', line 21

def self.typename
  return KEYWORD
end

Instance Method Details

#set_value(new_value) ⇒ Object

Set the value with any necessary type conversions.



35
36
37
# File 'lib/gloo/objs/basic/string.rb', line 35

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