ruby_sscanf 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: df915cc66b1691fb7e9c74d48aba08cb60cec10d
4
- data.tar.gz: 81529318abc9886ad74ebe0f749bbe8d3b3efe96
3
+ metadata.gz: 9b3aff8ecf681b1e92152004c653cfdc2925206d
4
+ data.tar.gz: e17f0677bae7aa9fa6eefb4307bab0f37f1490d2
5
5
  SHA512:
6
- metadata.gz: 61ecf231774391b5a9b956179a08c1e04153b1a6e7f2faf505e38906431608419054cfbca1b9cda961fac4a20600c9ceb94e7e6f9c13579eef526f7de6002c85
7
- data.tar.gz: 65adab881ced2faf3c4440d779db0997aeb0e8c48fa9cf31053b4063f3f3ff7bf955fe0996ca1f3a120046351ac5aa34823ccf35b245236c5e386accae023c24
6
+ metadata.gz: d7fc559a57dfdf39e518d42c9fed379003c775e6faf10ddcc0dffeaebd308a3e7d27b6bc4b3dcd7550cba3b4776d9c7d971c576137b5de58efbb278b324bfa86
7
+ data.tar.gz: 018dbf925c84f151a2186db83f99e2056c7f14043009fc3d19f5b3d4e4241b5c6dfeb266c5332a5ff7b0371aab9051f18fed27da4ea128a086caeb5292648e43
data/README.md CHANGED
@@ -75,6 +75,60 @@ leading '0x' or '0X'.
75
75
  * [chars] - Scan for a contiguous string of characters in the set [chars].
76
76
  * [^chars] - Scan for a contiguous string of characters not in the set [^chars]
77
77
 
78
+ ## Examples
79
+ Here are a few exmaples of the sscanf method in action.
80
+
81
+ "12 34 -56".sscanf "%d %2d %4d"
82
+ <br>returns [12, 34, -56]
83
+
84
+ "255 0b11111111 0377 0xFF 0 ".sscanf "%i %i %i %i %i"
85
+ <br>returns [255, 255, 255, 255, 0]
86
+
87
+ "7 10 377".sscanf "%o %o %o"
88
+ <br>returns [7, 8, 255]
89
+
90
+ "10 10011 11110000".sscanf "%b %b %b"
91
+ <br>returns [2, 19, 240]
92
+
93
+ "0 F FF FFF FFFF".sscanf "%x %x %x %x %x"
94
+ <br>returns [0, 15, 255, 4095, 65535]
95
+
96
+ "Hello Silly World".sscanf "%s %*s %s"
97
+ <br>returns ["Hello", "World"]
98
+
99
+ "Hello Silly World".sscanf "%5c %*5c %5c"
100
+ <br>returns ["Hello", "World"]
101
+
102
+ "42 The secret is X".sscanf "%i %-1c"
103
+ <br>returns [42, "The secret is X"]
104
+
105
+ "42 The secret is X".sscanf "%i %-2c%c"
106
+ <br>returns [42, "The secret is ", "X"]
107
+
108
+ "42 The secret is X".sscanf "%i %*-2c%c"
109
+ <br>returns [42, "X"]
110
+
111
+ "9.99 1.234e56 -1e100".sscanf "%f %f %f"
112
+ <br>returns [9.99, 1.234e56, -1e100]
113
+
114
+ "85% 75%".sscanf "%f%% %f%%"
115
+ <br>returns [85, 75]
116
+
117
+ "12 34 -56".sscanf "%u %u %u"
118
+ <br>returns [12, 34]
119
+
120
+ "1/2 3/4r -5/6".sscanf "%r %r %r"
121
+ <br>returns ['1/2'.to_r, '3/4'.to_r, '-5/6'.to_r]
122
+
123
+ "1+2i 3+4j -5e10-6.2i".sscanf "%j %j %j"
124
+ <br>returns [Complex('1+2i'), Complex('3+4j'), Complex('-5e10-6.2i')]
125
+
126
+ "'quote' 'silly' \"un quote\" 'a \\'' ".sscanf "%q %*q %q %q"
127
+ <br>returns ["quote", "un quote", "a '"]
128
+
129
+ "a b c".sscanf "%[a] %[b] %[c]"
130
+ <br>returns ["a", "b", "c"]
131
+
78
132
  ## Contributing
79
133
 
80
134
  #### Plan A
@@ -1,3 +1,3 @@
1
1
  module RubySscanf
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/ruby_sscanf.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "bundler", "~> 1.11"
28
28
  spec.add_development_dependency "rake", "~> 10.0"
29
29
  spec.add_development_dependency 'minitest', "~> 5.5.1"
30
- spec.add_development_dependency 'minitest_visible', "~> 0.0.1"
30
+ spec.add_development_dependency 'minitest_visible', "~> 0.0.2"
31
31
  spec.add_development_dependency 'rdoc', "~> 4.0.1"
32
32
 
33
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_sscanf
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
  - Peter Camilleri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-05 00:00:00.000000000 Z
11
+ date: 2016-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: format_engine
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.0.1
75
+ version: 0.0.2
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.0.1
82
+ version: 0.0.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rdoc
85
85
  requirement: !ruby/object:Gem::Requirement