lib/gloo/objs/basic/text.rb in gloo-0.3.0 vs lib/gloo/objs/basic/text.rb in gloo-0.4.0
- old
+ new
@@ -5,59 +5,82 @@
#
module Gloo
module Objs
class Text < Gloo::Core::Obj
-
- KEYWORD = 'text'
- KEYWORD_SHORT = 'txt'
- #
+ KEYWORD = 'text'.freeze
+ KEYWORD_SHORT = 'txt'.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
+ #
+ def set_value( new_value )
self.value = new_value.to_s
end
- #
+ #
# Does this object support multi-line values?
# Initially only true for scripts.
- #
- def has_multiline_value?
+ #
+ def multiline_value?
return false
end
-
- #
+
+ #
# Get the number of lines of text.
- #
+ #
def line_count
return value.split( "\n" ).count
end
-
-
+
# ---------------------------------------------------------------------
# Messages
# ---------------------------------------------------------------------
- #
+ #
# Get a list of message names that this object receives.
- #
+ #
def self.messages
return super
+ end
+
+ # ---------------------------------------------------------------------
+ # Help
+ # ---------------------------------------------------------------------
+
+ #
+ # Get help for this object type.
+ #
+ def self.help
+ return <<~TEXT
+ TEXT OBJECT TYPE
+ NAME: text
+ SHORTCUT: txt
+
+ DESCRIPTION
+ A longer, multi-line text string.
+
+ CHILDREN
+ None
+
+ MESSAGES
+ None
+ TEXT
end
end
end
end