format_engine 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -6
- data/irbt.rb +18 -0
- data/lib/format_engine/version.rb +1 -1
- data/{Rakefile → rakefile.rb} +1 -10
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c904ae546f955487f715b48fb097a51f61bd18f6
|
4
|
+
data.tar.gz: 1a1483942b8446094c6643880dd7352585581257
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 654806f3b8e3d57785186490cdea216652d331d220b8d510c0cd417ce908d6789519e6db2366a1e4324e1e92e95f4072764feec2b414018a2c72293f34c88699
|
7
|
+
data.tar.gz: a2b12548fc7424f26832a0d3948d16df60b89f606a67a5d473499a75543be52aa8933fd4532f1315071b3470049a1e34075f509a16c7a0b7c42cc26f8887eff8
|
data/README.md
CHANGED
@@ -19,6 +19,8 @@ Or install it yourself as:
|
|
19
19
|
|
20
20
|
$ gem install format_engine
|
21
21
|
|
22
|
+
The format_engine gem itself is found at: ( https://rubygems.org/gems/format_engine )
|
23
|
+
|
22
24
|
## Usage
|
23
25
|
|
24
26
|
In general the format engine allows for the easy creation of formatters and
|
@@ -138,6 +140,14 @@ puts cust.strfmt('%f %l is %a years old.')
|
|
138
140
|
#Etc, etc, etc ...
|
139
141
|
|
140
142
|
```
|
143
|
+
|
144
|
+
## In the wild...
|
145
|
+
|
146
|
+
An example of the format_engine in action is the ruby_sscanf
|
147
|
+
gem (https://github.com/PeterCamilleri/ruby_sscanf) where it is used to
|
148
|
+
provide a facility for parsing strings and extracting data along with a
|
149
|
+
generous helping of performance enhancement.
|
150
|
+
|
141
151
|
## Format Specification
|
142
152
|
|
143
153
|
Format String Specification Syntax (Regex):
|
@@ -181,6 +191,8 @@ alternative to \\% which is preferred.
|
|
181
191
|
|
182
192
|
### Literal
|
183
193
|
Text in between the various format specifications is treated as literal text.
|
194
|
+
When formatting this literal text is output verbatim. When parsing, this text
|
195
|
+
is expected in the input string.
|
184
196
|
|
185
197
|
###Format Internals:
|
186
198
|
|
@@ -291,9 +303,4 @@ fmt attribute, has itself, the following attributes:
|
|
291
303
|
#### Plan B
|
292
304
|
|
293
305
|
Go to the GitHub repository and raise an issue calling attention to some
|
294
|
-
aspect that could use some TLC or a suggestion or idea.
|
295
|
-
the issue that match the point you are trying to make. Then follow your
|
296
|
-
issue and keep up-to-date as it is worked on. All input are greatly
|
297
|
-
appreciated.
|
298
|
-
|
299
|
-
|
306
|
+
aspect that could use some TLC or a suggestion or idea.
|
data/irbt.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# An IRB + format_engine Test bed
|
3
|
+
|
4
|
+
require 'irb'
|
5
|
+
|
6
|
+
puts "Starting an IRB console with format_engine loaded."
|
7
|
+
|
8
|
+
if ARGV[0] == 'local'
|
9
|
+
require_relative 'lib/format_engine'
|
10
|
+
puts "format_engine loaded locally: #{FormatEngine::VERSION}"
|
11
|
+
|
12
|
+
ARGV.shift
|
13
|
+
else
|
14
|
+
require 'format_engine'
|
15
|
+
puts "format_engine loaded from gem: #{FormatEngine::VERSION}"
|
16
|
+
end
|
17
|
+
|
18
|
+
IRB.start
|
data/{Rakefile → rakefile.rb}
RENAMED
@@ -36,14 +36,7 @@ end
|
|
36
36
|
|
37
37
|
desc "Run an IRB Session with format_engine loaded."
|
38
38
|
task :console do
|
39
|
-
|
40
|
-
require 'irb/completion'
|
41
|
-
require './lib/format_engine'
|
42
|
-
puts "Starting an IRB console with format_engine."
|
43
|
-
puts "Use 'quit' to exit."
|
44
|
-
puts
|
45
|
-
ARGV.clear
|
46
|
-
IRB.start
|
39
|
+
system "ruby irbt.rb local"
|
47
40
|
end
|
48
41
|
|
49
42
|
desc "What version of code is this?"
|
@@ -51,5 +44,3 @@ task :vers do |t|
|
|
51
44
|
puts
|
52
45
|
puts "format_engine version = #{FormatEngine::VERSION}"
|
53
46
|
end
|
54
|
-
|
55
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: format_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
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-
|
11
|
+
date: 2016-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -92,9 +92,9 @@ files:
|
|
92
92
|
- Gemfile
|
93
93
|
- LICENSE.txt
|
94
94
|
- README.md
|
95
|
-
- Rakefile
|
96
95
|
- format_engine.gemspec
|
97
96
|
- format_engine.reek
|
97
|
+
- irbt.rb
|
98
98
|
- lib/format_engine.rb
|
99
99
|
- lib/format_engine/attr_formatter.rb
|
100
100
|
- lib/format_engine/attr_parser.rb
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- mocks/demo/demo_format.rb
|
113
113
|
- mocks/demo/demo_parse.rb
|
114
114
|
- mocks/test_person_mock.rb
|
115
|
+
- rakefile.rb
|
115
116
|
- reek.txt
|
116
117
|
- sire.rb
|
117
118
|
- tests/engine_base_tests.rb
|