ariadne_view_components 0.0.44-x86_64-darwin → 0.0.46-x86_64-darwin

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,90 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- module YARD
6
- # Helper methods to use for yard documentation
7
- module DocsHelper
8
- def one_of(enumerable, lower: false, sort: true)
9
- # Sort the array if requested
10
- if sort
11
- enumerable = enumerable.sort do |a, b|
12
- a.instance_of?(b.class) ? a <=> b : a.class.to_s <=> b.class.to_s
13
- end
14
- end
15
-
16
- values =
17
- case enumerable
18
- when Hash
19
- enumerable.map do |key, value|
20
- "#{pretty_value(key)} (#{pretty_value(value)})"
21
- end
22
- else
23
- enumerable.map do |key|
24
- pretty_value(key)
25
- end
26
- end
27
-
28
- prefix = "One of"
29
- prefix = prefix.downcase if lower
30
-
31
- "#{prefix} #{values.to_sentence(last_word_connector: ", or ")}."
32
- end
33
-
34
- def link_to_accessibility
35
- "[Accessibility](#accessibility)"
36
- end
37
-
38
- def link_to_classes_docs
39
- "[Classes and attributes](/classes-attributes)"
40
- end
41
-
42
- def link_to_attributes_docs
43
- "[Classes and attributes](/classes-attributes)"
44
- end
45
-
46
- def link_to_typography_docs
47
- "[Typography](/system-arguments#typography)"
48
- end
49
-
50
- def link_to_component(component)
51
- (status_module, component_name) = status_module_and_component_name(component)
52
- status_path = status_module.nil? ? "" : "/"
53
-
54
- "[#{component_name}](/components/#{status_path}#{component_name.underscore})"
55
- end
56
-
57
- def link_to_heroicons
58
- "[Heroicon](https://ariadne.style/heroicons/)"
59
- end
60
-
61
- def link_to_heading_practices
62
- "[Learn more about best heading practices (WAI Headings)](https://www.w3.org/WAI/tutorials/page-structure/headings/)"
63
- end
64
-
65
- def status_module_and_short_name(component)
66
- name_with_status = component.name.gsub(/Ariadne::|Component/, "")
67
-
68
- m = name_with_status.match(/(?<status>Beta|Alpha|Deprecated)?(?<_colons>::)?(?<name>.*)/)
69
- [m[:status]&.downcase, m[:name].gsub("::", "")]
70
- end
71
-
72
- def status_module_and_component_name(component)
73
- name_with_status = component.name.gsub(/Ariadne::/, "")
74
-
75
- m = name_with_status.match(/(?<status>Beta|Alpha|Deprecated)?(?<_colons>::)?(?<name>.*)/)
76
- [m[:status]&.downcase, m[:name].gsub("::", "")]
77
- end
78
-
79
- def pretty_value(val)
80
- case val
81
- when nil
82
- "`nil`"
83
- when Symbol
84
- "`:#{val}`"
85
- else
86
- "`#{val}`"
87
- end
88
- end
89
- end
90
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module YARD
4
- # YARD Handler to parse `renders_many` calls.
5
- class RendersManyHandler < YARD::Handlers::Ruby::Base
6
- handles method_call(:renders_many)
7
- namespace_only
8
-
9
- process do
10
- name = statement.parameters.first.jump(:tstring_content, :ident).source
11
- object = YARD::CodeObjects::MethodObject.new(namespace, name)
12
- register(object)
13
- parse_block(statement.last, owner: object)
14
-
15
- object.dynamic = true
16
- object[:renders_many] = true
17
- end
18
- end
19
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module YARD
4
- # YARD Handler to parse `renders_one` calls.
5
- class RendersOneHandler < YARD::Handlers::Ruby::Base
6
- handles method_call(:renders_one)
7
- namespace_only
8
-
9
- process do
10
- name = statement.parameters.first.jump(:tstring_content, :ident).source
11
- object = YARD::CodeObjects::MethodObject.new(namespace, name)
12
- register(object)
13
- parse_block(statement.last, owner: object)
14
-
15
- object.dynamic = true
16
- object[:renders_one] = true
17
- end
18
- end
19
- end