Class: Halunke::Runtime::HNativeObject
- Inherits:
-
Object
- Object
- Halunke::Runtime::HNativeObject
- Defined in:
- lib/halunke/runtime/hnative_object.rb
Instance Attribute Summary collapse
-
#ruby_value ⇒ Object
readonly
Returns the value of attribute ruby_value.
-
#runtime_class ⇒ Object
readonly
Returns the value of attribute runtime_class.
-
#source_code_position ⇒ Object
readonly
Returns the value of attribute source_code_position.
Instance Method Summary collapse
-
#initialize(runtime_class, ruby_value, source_code_position:) ⇒ HNativeObject
constructor
A new instance of HNativeObject.
- #inspect(context) ⇒ Object
- #receive_message(context, message_name, message_value, source_code_position: NullSourceCodePosition.new) ⇒ Object
Constructor Details
#initialize(runtime_class, ruby_value, source_code_position:) ⇒ HNativeObject
Returns a new instance of HNativeObject.
10 11 12 13 14 |
# File 'lib/halunke/runtime/hnative_object.rb', line 10 def initialize(runtime_class, ruby_value, source_code_position:) @runtime_class = runtime_class @ruby_value = ruby_value @source_code_position = source_code_position end |
Instance Attribute Details
#ruby_value ⇒ Object (readonly)
Returns the value of attribute ruby_value.
7 8 9 |
# File 'lib/halunke/runtime/hnative_object.rb', line 7 def ruby_value @ruby_value end |
#runtime_class ⇒ Object (readonly)
Returns the value of attribute runtime_class.
6 7 8 |
# File 'lib/halunke/runtime/hnative_object.rb', line 6 def runtime_class @runtime_class end |
#source_code_position ⇒ Object (readonly)
Returns the value of attribute source_code_position.
8 9 10 |
# File 'lib/halunke/runtime/hnative_object.rb', line 8 def source_code_position @source_code_position end |
Instance Method Details
#inspect(context) ⇒ Object
23 24 25 |
# File 'lib/halunke/runtime/hnative_object.rb', line 23 def inspect(context) (context, "inspect", []).ruby_value end |
#receive_message(context, message_name, message_value, source_code_position: NullSourceCodePosition.new) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/halunke/runtime/hnative_object.rb', line 16 def (context, , , source_code_position: NullSourceCodePosition.new) m = @runtime_class.lookup() m.(context, "call", [HArray.create_instance([self].concat())]) rescue KeyError raise HUnknownMessage.new(self.inspect(context), , @runtime_class.instance_methods.keys, source_code_position) if m.nil? end |