rucy 0.1.42 → 0.1.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c0d4d00b62adcf01d8f2ee424a6adece140ac088aa0f1b299c63290f0ac72d3
4
- data.tar.gz: 9edf2147f7ea53c8244f06dfa13826a434ec9f2a663a660b40c354e3df42a988
3
+ metadata.gz: 0fcc95c0c21d04de4f53c9caed38d7d6b86090836c91385e8534c867e385df93
4
+ data.tar.gz: f374debe70e1a8640adbd45080164f660e4dfc229124ab0bf4fe48eaf571ce2c
5
5
  SHA512:
6
- metadata.gz: 3d7216556614e017cb3e5b57aca1b5b4c4c8bb9de179e83b480b40c3d6a34eac11d5e00cb4321ba1f43a329f9eba043fc8c7cdde3a072590604b072315b3607c
7
- data.tar.gz: 982cb11d9bcad36501ab524769b5ef7413cd815235084d235d5a7feca71608615eea15e68051e1325e9194749e6e968c20c9ad04d54e5a570b735afec97a67e4
6
+ metadata.gz: cb25b0053607a9aece7c77d551918e3068a159ea614e03cf82e181c2b7d6fb07f9c526b5a115ec1d066f438e8d43ef64a0e713bba4f68b05db64f9fec20f9e7c
7
+ data.tar.gz: b9f3979051fd8c8e19e656f9f0a8df01a33202a76d3650c56fbf1973733c56a3f299919ce6ca702548774b748c5af5f9c10c88c9cabaf34845d3491ed5b4dea1
data/ChangeLog.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # rucy ChangeLog
2
2
 
3
3
 
4
+ ## [v0.1.43] - 2024-01-08
5
+
6
+ - Add Hash class
7
+ - Add set() and get() to Value class
8
+
9
+
4
10
  ## [v0.1.42] - 2023-12-09
5
11
 
6
12
  - Trigger github actions on all pull_request
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.42
1
+ 0.1.43
@@ -112,6 +112,10 @@ namespace Rucy
112
112
 
113
113
  Value inspect () const;
114
114
 
115
+ // String
116
+
117
+ const char* c_str () const;
118
+
115
119
  // Array
116
120
 
117
121
  Value push (Value obj);
@@ -126,16 +130,20 @@ namespace Rucy
126
130
 
127
131
  const Value& operator [] (size_t i) const;
128
132
 
129
- // String
133
+ // Hash
130
134
 
131
- const char* c_str () const;
135
+ void set (Value key, Value value);
132
136
 
133
- // Array / String
137
+ Value get (Value key) const;
138
+
139
+ // String / Array
134
140
 
135
141
  int length () const;
136
142
 
137
143
  int size () const;
138
144
 
145
+ // String / Array / Hash
146
+
139
147
  bool empty () const;
140
148
 
141
149
  protected:
@@ -145,6 +153,16 @@ namespace Rucy
145
153
  };// Value
146
154
 
147
155
 
156
+ class Hash : public Value
157
+ {
158
+
159
+ public:
160
+
161
+ Hash ();
162
+
163
+ };// Hash
164
+
165
+
148
166
  class GlobalValue : public Value
149
167
  {
150
168
 
data/src/value.cpp.erb CHANGED
@@ -321,6 +321,12 @@ namespace Rucy
321
321
  return call(inspect);
322
322
  }
323
323
 
324
+ const char*
325
+ Value::c_str () const
326
+ {
327
+ return as_s(true);
328
+ }
329
+
324
330
  Value
325
331
  Value::push (Value obj)
326
332
  {
@@ -357,10 +363,18 @@ namespace Rucy
357
363
  return const_cast<Value*>(this)->operator[](i);
358
364
  }
359
365
 
360
- const char*
361
- Value::c_str () const
366
+ void
367
+ Value::set (Value key, Value value)
362
368
  {
363
- return as_s(true);
369
+ RUCY_SYMBOL(array_set, "[]=");
370
+ call(array_set, key, value);
371
+ }
372
+
373
+ Value
374
+ Value::get (Value key) const
375
+ {
376
+ RUCY_SYMBOL(array_get, "[]");
377
+ return call(array_get, key);
364
378
  }
365
379
 
366
380
  static int
@@ -395,6 +409,12 @@ namespace Rucy
395
409
  }
396
410
 
397
411
 
412
+ Hash::Hash ()
413
+ : Value(rb_hash_new())
414
+ {
415
+ }
416
+
417
+
398
418
  GlobalValue::GlobalValue ()
399
419
  {
400
420
  init(false);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rucy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.42
4
+ version: 0.1.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-09 00:00:00.000000000 Z
11
+ date: 2024-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xot