Class: Gloo::Objs::Alias
- Inherits:
-
Core::Obj
- Object
- Core::Baseo
- Core::Obj
- Gloo::Objs::Alias
- Defined in:
- lib/gloo/objs/basic/alias.rb
Constant Summary collapse
- KEYWORD =
'alias'.freeze
- KEYWORD_SHORT =
'ln'.freeze
- ALIAS_REFERENCE =
'*'.freeze
Constants inherited from Core::Baseo
Core::Baseo::NOT_IMPLEMENTED_ERR
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.
-
.resolve_alias(engine, obj, ref_name = nil) ⇒ Object
Is the object an alias If so, then resolve it.
-
.short_typename ⇒ Object
The short name of the object type.
-
.typename ⇒ Object
The name of the object type.
Instance Method Summary collapse
-
#msg_resolve ⇒ Object
Check to see if the referenced object exists.
-
#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, #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_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
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.
43 44 45 |
# File 'lib/gloo/objs/basic/alias.rb', line 43 def self. return super + %w[resolve] end |
.resolve_alias(engine, obj, ref_name = nil) ⇒ Object
Is the object an alias If so, then resolve it. The ref_name is the name used to refer to the object. If it ends with the * then we won’t resolve the alias since we are trying to refer to the alias itself.
67 68 69 70 71 72 73 74 |
# File 'lib/gloo/objs/basic/alias.rb', line 67 def self.resolve_alias( engine, obj, ref_name = nil ) return nil unless obj return obj unless obj.type_display == Gloo::Objs::Alias.typename return obj if ref_name&.end_with?( ALIAS_REFERENCE ) ln = Gloo::Core::Pn.new( engine, obj.value ) return ln.resolve end |
.short_typename ⇒ Object
The short name of the object type.
25 26 27 |
# File 'lib/gloo/objs/basic/alias.rb', line 25 def self.short_typename return KEYWORD_SHORT end |
.typename ⇒ Object
The name of the object type.
18 19 20 |
# File 'lib/gloo/objs/basic/alias.rb', line 18 def self.typename return KEYWORD end |
Instance Method Details
#msg_resolve ⇒ Object
Check to see if the referenced object exists.
50 51 52 53 54 55 |
# File 'lib/gloo/objs/basic/alias.rb', line 50 def msg_resolve pn = Gloo::Core::Pn.new( @engine, self.value ) s = pn.exists? @engine.heap.it.set_to s return s end |
#set_value(new_value) ⇒ Object
Set the value with any necessary type conversions.
32 33 34 |
# File 'lib/gloo/objs/basic/alias.rb', line 32 def set_value( new_value ) self.value = new_value.to_s end |