marameters 3.9.0 → 3.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/marameters/builder.rb +2 -1
- data/lib/marameters/probe.rb +6 -4
- data/lib/marameters.rb +2 -0
- data/marameters.gemspec +2 -2
- data.tar.gz.sig +0 -0
- metadata +5 -5
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6055b9783bad6279da1aa6fcd04e0d5ca05d57fd39ddf0184ce9b5c3249f4c88
|
4
|
+
data.tar.gz: 50d4c40b521b4e45643baead5a29bc1366b3e125843533c59e29a5cb084c4432
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fac30249c2101bb2d282f374382fac240b5bde4220dcf01fccb9bb2a60af6791adf4e64eb48100271a79cb0c0608a7c695150f66f6d3c6eb6ae039480d6d977
|
7
|
+
data.tar.gz: a3d8050db029436095c69353680f2a76b30215d12833b3deba1c16d4f38187297af4e09461bc32fa3440b57972bab2daf56d8855b065f43463545730197d6cb0
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/marameters/builder.rb
CHANGED
@@ -7,11 +7,12 @@ module Marameters
|
|
7
7
|
@defaulter = defaulter
|
8
8
|
end
|
9
9
|
|
10
|
-
def call kind, name, default: nil
|
10
|
+
def call kind, name = nil, default: nil
|
11
11
|
case kind
|
12
12
|
when :req then name
|
13
13
|
when :opt then "#{name} = #{defaulter.call default}"
|
14
14
|
when :rest then "*#{name}"
|
15
|
+
when :nokey then "**nil"
|
15
16
|
when :keyreq then "#{name}:"
|
16
17
|
when :key then "#{name}: #{defaulter.call default}"
|
17
18
|
when :keyrest then "**#{name}"
|
data/lib/marameters/probe.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "forwardable"
|
4
|
+
|
3
5
|
module Marameters
|
4
6
|
# Provides information on a method's parameters.
|
5
7
|
class Probe
|
8
|
+
extend Forwardable
|
9
|
+
|
6
10
|
CATEGORIES = {
|
7
11
|
positionals: %i[req opt],
|
8
12
|
keywords: %i[keyreq key],
|
@@ -18,6 +22,8 @@ module Marameters
|
|
18
22
|
collection
|
19
23
|
end
|
20
24
|
|
25
|
+
delegate %i[deconstruct empty? include? to_a] => :parameters
|
26
|
+
|
21
27
|
attr_reader :keywords, :positionals, :splats
|
22
28
|
|
23
29
|
def initialize parameters, categories: CATEGORIES
|
@@ -29,8 +35,6 @@ module Marameters
|
|
29
35
|
|
30
36
|
def block? = (parameters in [*, [:block, *]])
|
31
37
|
|
32
|
-
def empty? = parameters.empty?
|
33
|
-
|
34
38
|
def keyword_slice collection, keys:
|
35
39
|
warn "`#{self.class}##{__method__}` is deprecated, use `#keywords_for` instead.",
|
36
40
|
category: :deprecated
|
@@ -69,8 +73,6 @@ module Marameters
|
|
69
73
|
|
70
74
|
def splats? = splats.any?
|
71
75
|
|
72
|
-
def to_a = parameters
|
73
|
-
|
74
76
|
def to_h = parameters.each.with_object({}) { |(key, name), attributes| attributes[key] = name }
|
75
77
|
|
76
78
|
private
|
data/lib/marameters.rb
CHANGED
@@ -10,6 +10,8 @@ end
|
|
10
10
|
|
11
11
|
# Main namespace.
|
12
12
|
module Marameters
|
13
|
+
KINDS = %i[req opt rest nokey keyreq key keyrest block].freeze
|
14
|
+
|
13
15
|
def self.loader registry = Zeitwerk::Registry
|
14
16
|
@loader ||= registry.loaders.find { |loader| loader.tag == File.basename(__FILE__, ".rb") }
|
15
17
|
end
|
data/marameters.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "marameters"
|
5
|
-
spec.version = "3.
|
5
|
+
spec.version = "3.11.0"
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
8
8
|
spec.homepage = "https://alchemists.io/projects/marameters"
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.cert_chain = [Gem.default_cert_path]
|
24
24
|
|
25
25
|
spec.required_ruby_version = ">= 3.3", "<= 3.4"
|
26
|
-
spec.add_dependency "refinements", "~> 12.
|
26
|
+
spec.add_dependency "refinements", "~> 12.10"
|
27
27
|
spec.add_dependency "zeitwerk", "~> 2.7"
|
28
28
|
|
29
29
|
spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marameters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
|
36
36
|
gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2024-10-
|
38
|
+
date: 2024-10-27 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: refinements
|
@@ -43,14 +43,14 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '12.
|
46
|
+
version: '12.10'
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '12.
|
53
|
+
version: '12.10'
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
name: zeitwerk
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '0'
|
115
115
|
requirements: []
|
116
|
-
rubygems_version: 3.5.
|
116
|
+
rubygems_version: 3.5.22
|
117
117
|
signing_key:
|
118
118
|
specification_version: 4
|
119
119
|
summary: A dynamic method parameter inspector.
|
metadata.gz.sig
CHANGED
Binary file
|