Class: YAMLStar
- Inherits:
-
Object
- Object
- YAMLStar
- Defined in:
- lib/yamlstar.rb,
lib/yamlstar/version.rb
Defined Under Namespace
Modules: LibYAMLStar
Constant Summary collapse
- Error =
Class.new(StandardError)
- LIBYAMLSTAR_VERSION =
VERSION- VERSION =
"0.1.11"
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Class Method Summary collapse
Instance Method Summary collapse
- #close ⇒ Object
- #dump(value) ⇒ Object
- #dump_all(values) ⇒ Object
-
#initialize ⇒ YAMLStar
constructor
A new instance of YAMLStar.
- #load(yaml) ⇒ Object
- #load_all(yaml) ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize ⇒ YAMLStar
Returns a new instance of YAMLStar.
90 91 92 93 94 95 96 97 98 |
# File 'lib/yamlstar.rb', line 90 def initialize @isolate = Fiddle::Pointer.malloc(Fiddle::SIZEOF_VOIDP) thread = Fiddle::Pointer.malloc(Fiddle::SIZEOF_VOIDP) rc = LibYAMLStar.graal_create_isolate(nil, @isolate.ref, thread.ref) raise Error, "Failed to create GraalVM isolate" unless rc.zero? @thread = thread @closed = false end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
88 89 90 |
# File 'lib/yamlstar.rb', line 88 def error @error end |
Class Method Details
.dump(value) ⇒ Object
80 81 82 |
# File 'lib/yamlstar.rb', line 80 def self.dump(value) new.dump(value) end |
.dump_all(values) ⇒ Object
84 85 86 |
# File 'lib/yamlstar.rb', line 84 def self.dump_all(values) new.dump_all(values) end |
.load(yaml) ⇒ Object
72 73 74 |
# File 'lib/yamlstar.rb', line 72 def self.load(yaml) new.load(yaml) end |
.load_all(yaml) ⇒ Object
76 77 78 |
# File 'lib/yamlstar.rb', line 76 def self.load_all(yaml) new.load_all(yaml) end |
Instance Method Details
#close ⇒ Object
120 121 122 123 124 125 126 127 |
# File 'lib/yamlstar.rb', line 120 def close return if @closed rc = LibYAMLStar.graal_tear_down_isolate(@thread) raise Error, "Failed to tear down GraalVM isolate" unless rc.zero? @closed = true end |
#dump(value) ⇒ Object
108 109 110 |
# File 'lib/yamlstar.rb', line 108 def dump(value) call_json(:yamlstar_dump, value) end |
#dump_all(values) ⇒ Object
112 113 114 |
# File 'lib/yamlstar.rb', line 112 def dump_all(values) call_json(:yamlstar_dump_all, values) end |
#load(yaml) ⇒ Object
100 101 102 |
# File 'lib/yamlstar.rb', line 100 def load(yaml) call_yaml(:yamlstar_load, yaml) end |
#load_all(yaml) ⇒ Object
104 105 106 |
# File 'lib/yamlstar.rb', line 104 def load_all(yaml) call_yaml(:yamlstar_load_all, yaml) end |
#version ⇒ Object
116 117 118 |
# File 'lib/yamlstar.rb', line 116 def version LibYAMLStar.yamlstar_version(@thread).to_s end |