cnc 0.1.9 → 0.1.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8459613ef49acef2ed7d23d7287ed2e0474837327ab06c4050575fac8e6e8f01
4
- data.tar.gz: 5f16174cced2e0bb4cf898a955d7a75168fe804a07aea26e333e1ab9e8c95bb1
3
+ metadata.gz: 68b3021b58286ffed2d5602400cb57f187ceab1dfa94b259574a4acda209693f
4
+ data.tar.gz: f4aa34da62d922d7ccb48bbf60ff2b6e7bd0ae3080a53cb06b8d18ca678ef617
5
5
  SHA512:
6
- metadata.gz: 50138b9621ef1d7909b5bec0c408d11e4df2bc6eeae689e7a8a86523e121d1eb5bed8cdb8efa9d6e172d464ec72908965fef8b7142e4ee0c8d479a08fd4c5ea5
7
- data.tar.gz: 486c616a3d8380af39a4c94d67a7d4450e4226e15feebacc46d2ef80c5a814a9ebca8782c8660b13a3a313a6399b211312fe9d6b0a45d9056bf0d10c62c90707
6
+ metadata.gz: 49a7f7da1b3f23793aa0a225efe0c6a1671598042fedbd2f4004150f27cc36eb8a21fd414e3c66db32027376b175bfe1e16f8fff33e59a9762df6c9dbb416f87
7
+ data.tar.gz: 51bfcb41d67fe31eab66a52f75f281c4870a42282984ab8178dc525ec9a2ce0c673b28bfc229c7b74e92c880b14bf0cd92f61086bf6d705b9898730e6244e657
@@ -1,12 +1,12 @@
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, **macros, &)
4
+ def define_class(name, *, **macros, &)
5
5
  name = name.to_s.camelize
6
6
  raise NameError, "class exists: #{name}" if const_defined?(name, false)
7
- klass = Class.new(parent) do
7
+ klass = Class.new(*) do
8
8
  macros.each {|key, value| send(key, *value) }
9
- class_eval(&)
9
+ class_eval(&) if block_given?
10
10
  end
11
11
  const_set name, klass
12
12
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module CNC
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.11"
3
3
  end
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.9
4
+ version: 0.1.11
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