ruby-macrodroid 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e58584da95b866b61497cebde9f89bac44a793ebdf23bc58d9cdcdfdb208419
4
- data.tar.gz: 79d881aee3a91df644efb1733b9664faab5b46e535bfe5ad10681a884b8f19ef
3
+ metadata.gz: b183aef5c9ca96ad7f0c3abbb5e3439dd6af1a9bb14b9da75ffb99edb9944554
4
+ data.tar.gz: 237916d146bd126816dfa8f8ffe420ffc8a75fa383d6b5893b4e85bf4702d948
5
5
  SHA512:
6
- metadata.gz: 181c71de158a1bff2a26cd6762c85961e4ae1eaaa7fc813a422ad700de73218d25902948e32161dd8c87d698ba3c833895f902dad9f568e46e384e682f2c9d7a
7
- data.tar.gz: 805329654e2d074217a0e2dc3a9738efd26fb010d91a7f1e4a0ff8f84f297103609e94f3d386bd8db191937f27a9f0be13502a9dc5f063eb36a6d208556ce49a
6
+ metadata.gz: ab40874c447fe623c393c3e9a4eab63a44ec71b6431cfd295cd95cf11412ad4c0c9f2238fc4e1038d0f256734dd29217e91a790fc927f1e2db1517eae8753bed
7
+ data.tar.gz: 056c5e9f07eb9f148276392ad881f1658addd43a7022102f6614326bb224a8b2824048647bd223c5f2a649e702b35573856a09a773dfa2b329245a660710fcd8
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -279,6 +279,59 @@ class ConstraintsNlp
279
279
  end
280
280
 
281
281
 
282
+ module Params
283
+
284
+ refine Hash do
285
+
286
+ # turns keys from camelCase into snake_case
287
+
288
+ def to_snake_case(h=self)
289
+
290
+ h.inject({}) do |r, x|
291
+
292
+ key, value = x
293
+ #puts 'value: ' + value.inspect
294
+
295
+ val = if value.is_a?(Hash) then
296
+ to_snake_case(value)
297
+ elsif value.is_a?(Array) and value.first.is_a? Hash
298
+ value.map {|row| to_snake_case(row)}
299
+ else
300
+ value
301
+ end
302
+
303
+ r.merge key.to_s.sub(/^m_/,'').gsub(/[A-Z][a-z]/){|x| '_' +
304
+ x.downcase}.gsub(/[a-z][A-Z]/){|x| x[0] + '_' + x[1].downcase}\
305
+ .downcase.to_sym => val
306
+
307
+ end
308
+ end
309
+
310
+ # turns keys from snake_case to CamelCase
311
+ def to_camel_case(h=self)
312
+
313
+ h.inject({}) do |r,x|
314
+
315
+ key, value = x
316
+
317
+ val = if value.is_a?(Hash) then
318
+ to_camel_case(value)
319
+ elsif value.is_a?(Array) and value.first.is_a? Hash
320
+ value.map {|row| to_camel_case(row)}
321
+ else
322
+ value
323
+ end
324
+
325
+ r.merge({key.to_s.gsub(/(?<!^m)_[a-z]/){|x| x[-1].upcase} => val})
326
+ end
327
+
328
+ end
329
+
330
+
331
+ end
332
+
333
+ end
334
+
282
335
 
283
336
  class Macro
284
337
  using ColouredText
@@ -692,6 +745,8 @@ EOF
692
745
  end
693
746
 
694
747
 
748
+
749
+
695
750
  class MacroDroidError < Exception
696
751
  end
697
752
 
@@ -8,59 +8,6 @@
8
8
  #
9
9
 
10
10
 
11
- module Params
12
-
13
- refine Hash do
14
-
15
- # turns keys from camelCase into snake_case
16
-
17
- def to_snake_case(h=self)
18
-
19
- h.inject({}) do |r, x|
20
-
21
- key, value = x
22
- #puts 'value: ' + value.inspect
23
-
24
- val = if value.is_a?(Hash) then
25
- to_snake_case(value)
26
- elsif value.is_a?(Array) and value.first.is_a? Hash
27
- value.map {|row| to_snake_case(row)}
28
- else
29
- value
30
- end
31
-
32
- r.merge key.to_s.sub(/^m_/,'').gsub(/[A-Z][a-z]/){|x| '_' +
33
- x.downcase}.gsub(/[a-z][A-Z]/){|x| x[0] + '_' + x[1].downcase}\
34
- .downcase.to_sym => val
35
-
36
- end
37
- end
38
-
39
- # turns keys from snake_case to CamelCase
40
- def to_camel_case(h=self)
41
-
42
- h.inject({}) do |r,x|
43
-
44
- key, value = x
45
-
46
- val = if value.is_a?(Hash) then
47
- to_camel_case(value)
48
- elsif value.is_a?(Array) and value.first.is_a? Hash
49
- value.map {|row| to_camel_case(row)}
50
- else
51
- value
52
- end
53
-
54
- r.merge({key.to_s.gsub(/(?<!^m)_[a-z]/){|x| x[-1].upcase} => val})
55
- end
56
-
57
- end
58
-
59
-
60
- end
61
-
62
- end
63
-
64
11
  class MacroObject
65
12
  using ColouredText
66
13
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-macrodroid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file