textutils 1.0.0 → 1.0.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 +4 -4
- data/Manifest.txt +1 -0
- data/README.md +5 -8
- data/Rakefile +1 -1
- data/lib/textutils/core_ext/array.rb +39 -0
- data/lib/textutils/core_ext/file.rb +6 -0
- data/lib/textutils/version.rb +1 -1
- data/lib/textutils.rb +4 -0
- 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: 0b0282aa2a7a821c25f24b39dd50a4486d3d3a68
|
4
|
+
data.tar.gz: 5d7c21778e9c4f3ebfec10bdcf18c861a84fd31a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 703c28f053cbc841cbcaffcecafab2896b5756be3a4a33b53bb0fc6fe83d310f5c249690301916343724ad1819c4c21b0f27a37d26702a7e109ab4aa87fc0070
|
7
|
+
data.tar.gz: 61d6e63ca7cbdc13ea4c70ee82ef3282835a71ccd29e04da8a7af5657398c81ed4f3c04ccbd2c7cd79dd7a77b2b8d6d1def52674a926f2e1c2a51fa56af3f491
|
data/Manifest.txt
CHANGED
data/README.md
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
Text Filters, Helpers, Readers and More in Ruby
|
4
4
|
|
5
|
-
* home :: [github.com/
|
6
|
-
* bugs :: [github.com/
|
5
|
+
* home :: [github.com/textkit/textutils](https://github.com/textkit/textutils)
|
6
|
+
* bugs :: [github.com/textkit/textutils/issues](https://github.com/textkit/textutils/issues)
|
7
7
|
* gem :: [rubygems.org/gems/textutils](https://rubygems.org/gems/textutils)
|
8
8
|
* rdoc :: [rubydoc.info/gems/textutils](http://rubydoc.info/gems/textutils)
|
9
9
|
* forum :: [ruby-talk@ruby-lang.org](www.ruby-lang.org/en/community/mailing-lists/)
|
@@ -91,16 +91,13 @@ The [`slideshow`](http://slideshow-s9.github.io) gem (also known as Slide Show (
|
|
91
91
|
that lets you create slide shows
|
92
92
|
and author slides in plain text using a wiki-style markup language that's easy-to-write and easy-to-read.
|
93
93
|
|
94
|
-
The [`markdown`](https://github.com/
|
94
|
+
The [`markdown`](https://github.com/writekit/markdown) gem that lets you use your markdown library
|
95
95
|
of choice.
|
96
96
|
|
97
|
-
The [`worlddb`](https://github.com/
|
97
|
+
The [`worlddb`](https://github.com/worlddb/world.db.ruby) gem that offers a command line tool for the open world database (`world.db`).
|
98
98
|
|
99
|
-
The [`sportdb`](https://github.com/
|
99
|
+
The [`sportdb`](https://github.com/sportdb/sport.db.ruby) gem that offers a command line tool for the open sport/football database (`sport.db`/`football.db`).
|
100
100
|
|
101
|
-
## Alternatives
|
102
|
-
|
103
|
-
TBD
|
104
101
|
|
105
102
|
## License
|
106
103
|
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ Hoe.spec 'textutils' do
|
|
8
8
|
self.summary = 'textutils - Text Filters, Helpers, Readers and More'
|
9
9
|
self.description = summary
|
10
10
|
|
11
|
-
self.urls = ['https://github.com/
|
11
|
+
self.urls = ['https://github.com/textkit/textutils']
|
12
12
|
|
13
13
|
self.author = 'Gerald Bauer'
|
14
14
|
self.email = 'ruby-talk@ruby-lang.org'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
|
4
|
+
class Array
|
5
|
+
|
6
|
+
## todo: check if there's already a builtin method for this
|
7
|
+
#
|
8
|
+
# note:
|
9
|
+
# in rails ary.in_groups(3) results in
|
10
|
+
# top-to-bottom, left-to-right.
|
11
|
+
# and not left-to-right first and than top-to-bottom.
|
12
|
+
#
|
13
|
+
# rename to in_groups_vertical(3) ???
|
14
|
+
|
15
|
+
def in_columns( cols ) # alias for convenience for chunks - needed? why? why not?
|
16
|
+
chunks( cols )
|
17
|
+
end
|
18
|
+
|
19
|
+
def chunks( number_of_chunks )
|
20
|
+
## NB: use chunks - columns might be in use by ActiveRecord!
|
21
|
+
###
|
22
|
+
# e.g.
|
23
|
+
# [1,2,3,4,5,6,7,8,9,10].columns(3)
|
24
|
+
# becomes:
|
25
|
+
# [[1,4,7,10],
|
26
|
+
# [2,5,8],
|
27
|
+
# [3,6,9]]
|
28
|
+
|
29
|
+
## check/todo: make a copy of the array first??
|
30
|
+
# for now reference to original items get added to columns
|
31
|
+
chunks = (1..number_of_chunks).collect { [] }
|
32
|
+
each_with_index do |item,index|
|
33
|
+
chunks[ index % number_of_chunks ] << item
|
34
|
+
end
|
35
|
+
chunks
|
36
|
+
end
|
37
|
+
|
38
|
+
end # class Array
|
39
|
+
|
@@ -6,6 +6,12 @@ class File
|
|
6
6
|
file.read
|
7
7
|
end
|
8
8
|
|
9
|
+
## todo/fix:
|
10
|
+
## normalize newlines
|
11
|
+
## always use \n
|
12
|
+
## convert \n\r (Windows) => \n
|
13
|
+
## convert \r (old? Mac) => \n
|
14
|
+
|
9
15
|
# NB: for convenience: convert fancy unicode dashes/hyphens to plain ascii hyphen-minus
|
10
16
|
text = TextUtils.convert_unicode_dashes_to_plain_ascii( text, path: path )
|
11
17
|
|
data/lib/textutils/version.rb
CHANGED
data/lib/textutils.rb
CHANGED
@@ -7,6 +7,8 @@ require 'yaml'
|
|
7
7
|
require 'erb'
|
8
8
|
require 'pp'
|
9
9
|
require 'fileutils'
|
10
|
+
require 'time'
|
11
|
+
require 'date'
|
10
12
|
|
11
13
|
|
12
14
|
# 3rd party gems / libs
|
@@ -46,6 +48,8 @@ require 'textutils/helper/value_helper'
|
|
46
48
|
require 'textutils/utils'
|
47
49
|
require 'textutils/core_ext/file'
|
48
50
|
require 'textutils/core_ext/time'
|
51
|
+
require 'textutils/core_ext/array'
|
52
|
+
|
49
53
|
|
50
54
|
require 'textutils/parser/name_parser'
|
51
55
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: textutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: props
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- Rakefile
|
111
111
|
- lib/textutils.rb
|
112
112
|
- lib/textutils/classifier.rb
|
113
|
+
- lib/textutils/core_ext/array.rb
|
113
114
|
- lib/textutils/core_ext/file.rb
|
114
115
|
- lib/textutils/core_ext/time.rb
|
115
116
|
- lib/textutils/filter/code_filter.rb
|
@@ -154,7 +155,7 @@ files:
|
|
154
155
|
- test/test_title_mapper.rb
|
155
156
|
- test/test_unicode_helper.rb
|
156
157
|
- test/test_values_reader.rb
|
157
|
-
homepage: https://github.com/
|
158
|
+
homepage: https://github.com/textkit/textutils
|
158
159
|
licenses:
|
159
160
|
- Public Domain
|
160
161
|
metadata: {}
|