ucl 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/ext/ucl.c +23 -3
  3. data/ucl.gemspec +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 123bfade721343ef51a1b839b450365e7d2aa934e16e9d537a708582336aca60
4
- data.tar.gz: c2f59b562e9a13fb4535e65055acf6d4fa8e140161ecb445875699314163cc93
3
+ metadata.gz: 425cfe9bbc447dd450e023ce22cf7d87ff55999c44e9c662c478bfb04f27afdc
4
+ data.tar.gz: c71501063aa394c0f32f8a9e6ad66f4ca54a61309af6ee1f9e78d960d26711da
5
5
  SHA512:
6
- metadata.gz: fe5a117504dd4694952d5555107a8c7c886ca25a5a2bebe5e52f394552fbf39386175040080a85dcaf4a240d7837af436a483255ae0f2411932de2b62bbed98f
7
- data.tar.gz: ccebbfb07adabb8e892c855ccacf385ee79a81415b5f57a1b1ce50fffb7fb01e233902265bac6f6950fc3aa93e44f8a8067c122a08e029ce85df1348294bb94c
6
+ metadata.gz: dd42a5c178ca47bf3287b72bf7fa150ca21242c457cb8421590fa12f41a8d721079c3fe582335d85e7339c5cd5fd0b866dad2fa3a9569dba1eebf0460f4e2089
7
+ data.tar.gz: ca19582a1d3ef8882e46dae1da77c614d59cfe953b86fb05bc82e8dae491af6388acdf2085075c90b2f324870dc8ec26e6aebc8c8f6cd9d7f7513c334897b90a
data/ext/ucl.c CHANGED
@@ -103,6 +103,20 @@ _iterate_valid_ucl(ucl_object_t const *root, int flags)
103
103
  }
104
104
  }
105
105
 
106
+ static VALUE
107
+ ucl_s_get_flags(VALUE klass)
108
+ {
109
+ return rb_iv_get(klass, "@flags");
110
+ }
111
+
112
+
113
+ static VALUE
114
+ ucl_s_set_flags(VALUE klass, VALUE val)
115
+ {
116
+ rb_check_type(val, T_FIXNUM);
117
+ rb_iv_set(klass, "@flags", val);
118
+ return val;
119
+ }
106
120
 
107
121
 
108
122
  /**
@@ -123,7 +137,7 @@ ucl_s_parse(int argc, VALUE *argv, VALUE klass)
123
137
 
124
138
  VALUE data, flags;
125
139
  rb_scan_args(argc, argv, "11", &data, &flags);
126
- if (NIL_P(flags)) flags = INT2FIX(0);
140
+ if (NIL_P(flags)) flags = ucl_s_get_flags(mUCL);
127
141
 
128
142
  rb_check_type(data, T_STRING);
129
143
  rb_check_type(flags, T_FIXNUM);
@@ -189,6 +203,8 @@ ucl_s_load_file(int argc, VALUE *argv, VALUE klass)
189
203
 
190
204
 
191
205
 
206
+
207
+
192
208
  void Init_ucl(void) {
193
209
  /* Main classes */
194
210
  mUCL = rb_define_class("UCL", rb_cObject);
@@ -200,11 +216,15 @@ void Init_ucl(void) {
200
216
  rb_define_const(mUCL, "DISABLE_MACRO", INT2FIX(UCL_PARSER_DISABLE_MACRO));
201
217
  rb_define_const(mUCL, "NO_FILEVARS", INT2FIX(UCL_PARSER_NO_FILEVARS ));
202
218
  rb_define_const(mUCL, "KEY_SYMBOL", INT2FIX(UCL_PARSER_KEY_SYMBOL ));
203
-
219
+
220
+ /* Variables */
221
+ ucl_s_set_flags(mUCL, INT2FIX(0));
222
+
204
223
  /* Definitions */
205
224
  rb_define_singleton_method(mUCL, "load_file", ucl_s_load_file, -1);
206
225
  rb_define_singleton_method(mUCL, "parse", ucl_s_parse, -1);
207
-
226
+ rb_define_singleton_method(mUCL, "flags", ucl_s_get_flags, 0);
227
+ rb_define_singleton_method(mUCL, "flags=", ucl_s_set_flags, 1);
208
228
  }
209
229
 
210
230
 
data/ucl.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ucl'
3
- s.version = '0.1.0'
3
+ s.version = '0.1.1'
4
4
  s.summary = " Universal configuration library parser"
5
5
  s.description = <<~EOF
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ucl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stéphane D'Alu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-19 00:00:00.000000000 Z
11
+ date: 2022-12-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2+
14
14