curltoruby 0.1.0 → 0.1.1

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: 4f569368c3d18e1596bb1ad213e95d27f12a72d51424e2004a1bbc0eea650db3
4
- data.tar.gz: ff6108b7fa7510497bb1debda11c8e73060b4e0b39d7044f6935f0d80125d53b
3
+ metadata.gz: 27dbf745f7a52fa725978a437ba7698194c007202e4303f08d0d9532bddf6fd6
4
+ data.tar.gz: e54077d0845d97ae9f7018d709cd48017fa6db898e8b6a13bd6b5d43317a34f7
5
5
  SHA512:
6
- metadata.gz: b6618d9847b8b5a5ac5e3d187591c42e3fb48bc0fb90de6a6d24b32abdaf91c052683a44114e7a12fee048d30194bd1ddb7decf2347fd98312ac961a3f101875
7
- data.tar.gz: 714c5c2cbb403aaa61eca889129d542de05ca6c6c03c3f815e63bd21c9dfc3254bddf9ce1e912bead111525161477fbd46c112f9452fad31a7ac57ba135c9767
6
+ metadata.gz: 5739a05c78f6c2889f9c7621ebab2e8fbb1bd83bbd4aae26989f0fffa049abf39188a7767c19a70013db04b3470d4072a61b2fe0033ce552c2b29d086e927a22
7
+ data.tar.gz: 1c29979c91685f49ad417dcd408df9697022693117bf65100286275f9d5dc226c820ab81a993df94de821252c264071a228bd0f652e13c67ab1f9c6974faa3f7
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/curltoruby.rb CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  # file: curltoruby.rb
4
4
 
5
- # description: Inspired by jhawthorn's curl-to-ruby.
6
- # see https://jhawthorn.github.io/curl-to-ruby/
5
+ # description: Inspired by jhawthorn's curl-to-ruby. see https://jhawthorn.github.io/curl-to-ruby/
7
6
 
8
7
 
9
8
  require 'lineparser'
@@ -12,9 +11,11 @@ require 'clipboard'
12
11
 
13
12
  class CurlToRuby
14
13
 
15
- def initialize(s)
14
+ def initialize(s, debug: false)
15
+
16
+ @debug = debug
16
17
  @h = parse(s)
17
- @s = build_code(@h)
18
+
18
19
  end
19
20
 
20
21
  def to_h()
@@ -23,8 +24,10 @@ class CurlToRuby
23
24
 
24
25
  def to_s()
25
26
 
27
+ @s = build_code(@h)
26
28
  Clipboard.copy @s
27
29
  puts 'copied to clipboard'
30
+
28
31
  @s
29
32
 
30
33
  end
@@ -67,7 +70,7 @@ EOF
67
70
 
68
71
  def parse(raws)
69
72
 
70
- s = raws.gsub(/^\s+/,'')
73
+ s = raws.gsub(/^\s+/,'').gsub(/(-H|--data-raw)/, "\n" + '\0')
71
74
 
72
75
  patterns = [
73
76
  [:root, /(?<=curl ')([^']+)/, :url],
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curltoruby
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
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  DTFw0mmzJ61f/aZOWaYGhrg0GiDGz7H+D02hgfE5TEiNPDVqtX9gMTOLxxlRKU38
36
36
  BxRpOlBnkLtQ7mXTeu2CADfP
37
37
  -----END CERTIFICATE-----
38
- date: 2022-05-18 00:00:00.000000000 Z
38
+ date: 2022-05-19 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: lineparser
metadata.gz.sig CHANGED
Binary file