Class: Godot::RubyScript
- Inherits:
-
ScriptExtension
- Object
- ScriptExtension
- Godot::RubyScript
- Defined in:
- lib/godot_rb/ruby_script.rb
Defined Under Namespace
Modules: Autoloads
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
The parsed class, which may be de-sync with #source_code until #_reloaded.
-
#source_code ⇒ Object
The Godot Editor pass entire source code( references)s around to enable IDE capabilities independent of the disk.
Class Method Summary collapse
Instance Method Summary collapse
- #_get_base_script ⇒ Object
- #_get_global_name ⇒ Object
- #_get_instance_base_type ⇒ Object
- #_get_language ⇒ Object
- #_get_source_code ⇒ Object
- #_has_source_code ⇒ Object
- #_instance_has(obj) ⇒ Object
-
#_is_tool ⇒ Object
TODO: LSP integration.
- #_is_valid ⇒ Object (also: #_can_instantiate)
- #_reload(_keep_state) ⇒ Object
-
#initialize(klass = nil) ⇒ RubyScript
constructor
A new instance of RubyScript.
-
#new ⇒ Object
! void _update_exports ( ) virtual.
Constructor Details
#initialize(klass = nil) ⇒ RubyScript
Returns a new instance of RubyScript.
8 9 10 11 12 |
# File 'lib/godot_rb/ruby_script.rb', line 8 def initialize(klass = nil) #TODO check type of `klass` klass&.const_set :RUBY_SCRIPT, self @klass = klass end |
Instance Attribute Details
#klass ⇒ Object (readonly)
The parsed class, which may be de-sync with #source_code until #_reloaded
7 8 9 |
# File 'lib/godot_rb/ruby_script.rb', line 7 def klass @klass end |
#source_code ⇒ Object
The Godot Editor pass entire source code( references)s around to enable IDE capabilities independent of the disk
15 16 17 |
# File 'lib/godot_rb/ruby_script.rb', line 15 def source_code @source_code end |
Class Method Details
.base_class_name ⇒ Object
4 |
# File 'lib/godot_rb/ruby_script.rb', line 4 def self.base_class_name = StringName.new 'ScriptExtension' |
Instance Method Details
#_get_base_script ⇒ Object
38 39 40 |
# File 'lib/godot_rb/ruby_script.rb', line 38 def _get_base_script klass.superclass.const_get :RUBY_SCRIPT if klass end |
#_get_global_name ⇒ Object
28 29 30 31 |
# File 'lib/godot_rb/ruby_script.rb', line 28 def _get_global_name name = klass&.name #: ::String? name ? StringName.new(name) : StringName.new end |
#_get_instance_base_type ⇒ Object
41 |
# File 'lib/godot_rb/ruby_script.rb', line 41 def _get_instance_base_type = klass ? klass.base_class_name : StringName.new |
#_get_language ⇒ Object
24 25 |
# File 'lib/godot_rb/ruby_script.rb', line 24 def _get_language = Godot::RubyLanguage::INSTANCE # TODO: LSP integration |
#_get_source_code ⇒ Object
16 |
# File 'lib/godot_rb/ruby_script.rb', line 16 def _get_source_code = source_code || String.new |
#_has_source_code ⇒ Object
18 |
# File 'lib/godot_rb/ruby_script.rb', line 18 def _has_source_code = source_code.nonzero? |
#_instance_has(obj) ⇒ Object
36 |
# File 'lib/godot_rb/ruby_script.rb', line 36 def _instance_has(obj) = klass ? obj.instance_of?(klass) : false |
#_is_tool ⇒ Object
TODO: LSP integration
26 |
# File 'lib/godot_rb/ruby_script.rb', line 26 def _is_tool = true |
#_is_valid ⇒ Object Also known as: _can_instantiate
32 33 34 |
# File 'lib/godot_rb/ruby_script.rb', line 32 def _is_valid = !!klass # *Cannot* instantiate if the script is non-existent (it shouldn’t); # *shouldn’t* instantiate if it’s invalid (fails static checks) |
#_reload(_keep_state) ⇒ Object
20 21 22 |
# File 'lib/godot_rb/ruby_script.rb', line 20 def _reload(_keep_state) 1 # TODO end |
#new ⇒ Object
!
void _update_exports ( ) virtual
! Standard Reflection
Dictionary _get_constants ( ) virtual const
StringName[] _get_members ( ) virtual const
Dictionary _get_method_info ( StringName method ) virtual const
Dictionary[] _get_script_method_list ( ) virtual const
bool _has_method ( StringName method ) virtual const
bool _inherits_script ( Script script ) virtual const
! Extended Reflection
Dictionary[] _get_script_property_list ( ) virtual const
bool _has_property_default_value ( StringName property ) virtual const
Variant _get_property_default_value ( StringName property ) virtual const
Extended Reflection
Dictionary[] _get_script_signal_list ( ) virtual const
bool _has_script_signal ( StringName signal ) virtual const
LSP integration
Dictionary[] _get_documentation ( ) virtual const
int _get_member_line ( StringName member ) virtual const
TODO: Ask the Godot community for a description on placeholders and fallbacks
bool _is_placeholder_fallback_enabled ( ) virtual const
void _placeholder_erased ( void* placeholder ) virtual
GDExtensionScriptInstancePtr _placeholder_instance_create ( Object for_object ) virtual const
?
def _get_rpc_config: () -> Variant
75 76 77 78 |
# File 'lib/godot_rb/ruby_script.rb', line 75 def new(...) # Temporary workaround until script initializing finds insight klass.new(...).tap { _1.set_script self } end |