cnc 0.1.8 → 0.1.10
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/lib/cnc/core_ext/module.rb +6 -2
- data/lib/cnc/core_ext/uri.rb +23 -0
- data/lib/cnc/version.rb +1 -1
- data/rubocop.yml +1 -1
- metadata +16 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e6706e3ee380e33d2ccf32c2c200e8dbdf5ea5189d35257dead75ddd7c849af9
|
|
4
|
+
data.tar.gz: 1ac76ab138162a2acc1102574ede700a85d79d3d251d75555b6beff53cc703ea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6bcabd1a6ad9a92c2f69e188000ea9eba92f218338e78c98beddc6bc4d5cbf3fd8b9417b6db79831e143993bacb72343d7b17c2fa4ac9655323cda3d084d1cf8
|
|
7
|
+
data.tar.gz: b87998ee93a6a7fa66197de3961ccad8af65e36f5352cd934acfb1ba184d1776dc0f0c462040e8beb38552ee1aa6b655cf5c0f839e01177a656ada8652a7c4cf
|
data/lib/cnc/core_ext/module.rb
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
class Module
|
|
2
2
|
# Shorthand for `const_set(name.camelize, Class.new(parent) { ... })`.
|
|
3
3
|
# Useful when defining classes in macros.
|
|
4
|
-
def define_class(name, parent = nil, &)
|
|
4
|
+
def define_class(name, parent = nil, **macros, &)
|
|
5
5
|
name = name.to_s.camelize
|
|
6
6
|
raise NameError, "class exists: #{name}" if const_defined?(name, false)
|
|
7
|
-
|
|
7
|
+
klass = Class.new(parent) do
|
|
8
|
+
macros.each {|key, value| send(key, *value) }
|
|
9
|
+
class_eval(&)
|
|
10
|
+
end
|
|
11
|
+
const_set name, klass
|
|
8
12
|
end
|
|
9
13
|
|
|
10
14
|
# Defines a constant of the given name using the given block if it doesn't
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require "uri"
|
|
2
|
+
require "rack"
|
|
3
|
+
|
|
4
|
+
class URI::Generic
|
|
5
|
+
def params
|
|
6
|
+
Rack::Utils.parse_query(query)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# Returns true if this URI is the same or less specific than `oth` URI.
|
|
10
|
+
def <=(oth)
|
|
11
|
+
oth = URI(oth)
|
|
12
|
+
oth.path.start_with?(path) && params <= oth.params
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Returns true if `oth` URI is the same or less specific than itself.
|
|
16
|
+
def >=(oth)
|
|
17
|
+
oth = URI(oth)
|
|
18
|
+
path.start_with?(oth.path) && params >= oth.params
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def >(oth) = URI(oth) <= self
|
|
22
|
+
def <(oth) = URI(oth) >= self
|
|
23
|
+
end
|
data/lib/cnc/version.rb
CHANGED
data/rubocop.yml
CHANGED
|
@@ -85,7 +85,7 @@ Minitest/LifecycleHooksOrder: # new in 0.28
|
|
|
85
85
|
Minitest/LiteralAsActualArgument: # new in 0.10
|
|
86
86
|
Enabled: true
|
|
87
87
|
Minitest/MultipleAssertions: # new in 0.10
|
|
88
|
-
Enabled:
|
|
88
|
+
Enabled: false
|
|
89
89
|
Minitest/NonExecutableTestMethod: # new in 0.34
|
|
90
90
|
Enabled: true
|
|
91
91
|
Minitest/NonPublicTestMethod: # new in 0.27
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cnc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeff Peterson
|
|
@@ -65,6 +65,20 @@ dependencies:
|
|
|
65
65
|
- - ">="
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
67
|
version: '0'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: rack
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0'
|
|
75
|
+
type: :runtime
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0'
|
|
68
82
|
- !ruby/object:Gem::Dependency
|
|
69
83
|
name: listen
|
|
70
84
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -126,6 +140,7 @@ files:
|
|
|
126
140
|
- lib/cnc/core_ext/module.rb
|
|
127
141
|
- lib/cnc/core_ext/object.rb
|
|
128
142
|
- lib/cnc/core_ext/symbol.rb
|
|
143
|
+
- lib/cnc/core_ext/uri.rb
|
|
129
144
|
- lib/cnc/migrator.rb
|
|
130
145
|
- lib/cnc/version.rb
|
|
131
146
|
- lib/tasks/cnc_tasks.rake
|