thomas_utils 0.1.13.2 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +0 -0
- data/README.md +0 -0
- data/lib/thomas_utils/future.rb +0 -0
- data/lib/thomas_utils/future_wrapper.rb +0 -0
- data/lib/thomas_utils/key_child.rb +29 -0
- data/lib/thomas_utils/key_comparer.rb +9 -13
- data/lib/thomas_utils/key_indexer.rb +3 -7
- data/lib/thomas_utils/multi_future_wrapper.rb +0 -0
- data/lib/thomas_utils/object_stream.rb +0 -0
- data/lib/thomas_utils/periodic_flusher.rb +0 -0
- data/lib/thomas_utils/symbol_helpers.rb +26 -0
- data/lib/thomas_utils.rb +3 -0
- metadata +10 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c7a26128e8f74017832ffb04f750ac8b3ffe0e4
|
4
|
+
data.tar.gz: 0bbe301c720ba3ea86d32021c50ef93a3a484c4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fc4c8aa79311c01d78ea48ac4e320a604c94630d9541a86411c8fdb8342f3c8eb07169df745df481e231f1214c0cddabdc9f542c8da9694b08782ba6df0d187
|
7
|
+
data.tar.gz: 2812ec24a201b64f98c45633ae0fa8ddb47e9163339d588047b8204ec2b1e1e2400aff678a0705b71c504807d1b075530078e503703a69cdaae0caef986b6238
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
File without changes
|
data/lib/thomas_utils/future.rb
CHANGED
File without changes
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module ThomasUtils
|
2
|
+
class KeyChild
|
3
|
+
include SymbolHelpers
|
4
|
+
|
5
|
+
attr_reader :key, :child
|
6
|
+
|
7
|
+
def initialize(key, child)
|
8
|
+
@key = key
|
9
|
+
@child = child
|
10
|
+
end
|
11
|
+
|
12
|
+
def new_key(key)
|
13
|
+
KeyChild.new(key, child)
|
14
|
+
end
|
15
|
+
|
16
|
+
def quote(quote)
|
17
|
+
quoted_key = if key.respond_to?(:quote)
|
18
|
+
key.quote(quote)
|
19
|
+
else
|
20
|
+
"#{quote}#{key}#{quote}"
|
21
|
+
end
|
22
|
+
"#{quoted_key}.#{quote}#{child}#{quote}"
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_s
|
26
|
+
"#{@key}.#{@child}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module ThomasUtils
|
2
2
|
class KeyComparer
|
3
|
-
OPERATOR_MAP = {eq: '=', ge: '>=', gt: '>', le: '<=', lt: '<', ne: '!='}
|
4
3
|
|
5
4
|
attr_reader :key
|
6
5
|
|
@@ -13,6 +12,15 @@ module ThomasUtils
|
|
13
12
|
KeyComparer.new(updated_key, @comparer)
|
14
13
|
end
|
15
14
|
|
15
|
+
def quote(quote)
|
16
|
+
quoted_key = if key.respond_to?(:quote)
|
17
|
+
key.quote(quote)
|
18
|
+
else
|
19
|
+
"#{quote}#{key}#{quote}"
|
20
|
+
end
|
21
|
+
"#{quoted_key} #{@comparer}"
|
22
|
+
end
|
23
|
+
|
16
24
|
def to_s
|
17
25
|
"#{pretty_key} #{@comparer}"
|
18
26
|
end
|
@@ -36,15 +44,3 @@ module ThomasUtils
|
|
36
44
|
end
|
37
45
|
end
|
38
46
|
end
|
39
|
-
|
40
|
-
class Symbol
|
41
|
-
ThomasUtils::KeyComparer::OPERATOR_MAP.each do |method, operator|
|
42
|
-
define_method(method) { ThomasUtils::KeyComparer.new(self, operator) }
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
class Array
|
47
|
-
ThomasUtils::KeyComparer::OPERATOR_MAP.each do |method, operator|
|
48
|
-
define_method(method) { ThomasUtils::KeyComparer.new(self, operator) }
|
49
|
-
end
|
50
|
-
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module ThomasUtils
|
2
2
|
class KeyIndexer
|
3
|
+
include SymbolHelpers
|
4
|
+
|
3
5
|
attr_reader :key
|
4
6
|
|
5
7
|
def initialize(key, index)
|
@@ -11,10 +13,4 @@ module ThomasUtils
|
|
11
13
|
"#{@key}['#{@index}']"
|
12
14
|
end
|
13
15
|
end
|
14
|
-
end
|
15
|
-
|
16
|
-
class Symbol
|
17
|
-
def index(index)
|
18
|
-
ThomasUtils::KeyIndexer.new(self, index)
|
19
|
-
end
|
20
|
-
end
|
16
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module ThomasUtils
|
2
|
+
module SymbolHelpers
|
3
|
+
OPERATOR_MAP = {eq: '=', ge: '>=', gt: '>', le: '<=', lt: '<', ne: '!='}
|
4
|
+
|
5
|
+
OPERATOR_MAP.each do |method, operator|
|
6
|
+
define_method(method) { ThomasUtils::KeyComparer.new(self, operator) }
|
7
|
+
end
|
8
|
+
|
9
|
+
def index(index)
|
10
|
+
ThomasUtils::KeyIndexer.new(self, index)
|
11
|
+
end
|
12
|
+
|
13
|
+
def child(name)
|
14
|
+
ThomasUtils::KeyChild.new(self, name)
|
15
|
+
end
|
16
|
+
alias :>> :child
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class Symbol
|
21
|
+
include ThomasUtils::SymbolHelpers
|
22
|
+
end
|
23
|
+
|
24
|
+
class Array
|
25
|
+
include ThomasUtils::SymbolHelpers
|
26
|
+
end
|
data/lib/thomas_utils.rb
CHANGED
@@ -15,11 +15,14 @@
|
|
15
15
|
#++
|
16
16
|
|
17
17
|
require 'concurrent'
|
18
|
+
require 'workers'
|
18
19
|
|
20
|
+
require 'thomas_utils/symbol_helpers'
|
19
21
|
require 'thomas_utils/object_stream'
|
20
22
|
require 'thomas_utils/periodic_flusher'
|
21
23
|
require 'thomas_utils/future_wrapper'
|
22
24
|
require 'thomas_utils/multi_future_wrapper'
|
23
25
|
require 'thomas_utils/key_comparer'
|
24
26
|
require 'thomas_utils/key_indexer'
|
27
|
+
require 'thomas_utils/key_child'
|
25
28
|
require 'thomas_utils/future'
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thomas_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas RM Rogers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.8'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.8'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: workers
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0.3'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.3'
|
41
41
|
description: |-
|
@@ -52,11 +52,13 @@ files:
|
|
52
52
|
- lib/thomas_utils.rb
|
53
53
|
- lib/thomas_utils/future.rb
|
54
54
|
- lib/thomas_utils/future_wrapper.rb
|
55
|
+
- lib/thomas_utils/key_child.rb
|
55
56
|
- lib/thomas_utils/key_comparer.rb
|
56
57
|
- lib/thomas_utils/key_indexer.rb
|
57
58
|
- lib/thomas_utils/multi_future_wrapper.rb
|
58
59
|
- lib/thomas_utils/object_stream.rb
|
59
60
|
- lib/thomas_utils/periodic_flusher.rb
|
61
|
+
- lib/thomas_utils/symbol_helpers.rb
|
60
62
|
homepage: https://www.github.com/thomasrogers03/thomas_utils
|
61
63
|
licenses:
|
62
64
|
- Apache License 2.0
|
@@ -67,12 +69,12 @@ require_paths:
|
|
67
69
|
- lib
|
68
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
69
71
|
requirements:
|
70
|
-
- -
|
72
|
+
- - ">="
|
71
73
|
- !ruby/object:Gem::Version
|
72
74
|
version: '0'
|
73
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
76
|
requirements:
|
75
|
-
- -
|
77
|
+
- - ">="
|
76
78
|
- !ruby/object:Gem::Version
|
77
79
|
version: '0'
|
78
80
|
requirements: []
|