Module: Explicit::ApplicationHelper
- Defined in:
- app/helpers/explicit/application_helper.rb
Instance Method Summary collapse
- #format_request_example(request:, example:) ⇒ Object
- #type_attribute_render(name:, type:) ⇒ Object
- #type_constraint(name, value) ⇒ Object
- #type_constraints(&block) ⇒ Object
- #type_has_details?(type) ⇒ Boolean
- #type_render(type) ⇒ Object
Instance Method Details
#format_request_example(request:, example:) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'app/helpers/explicit/application_helper.rb', line 27 def format_request_example(request:, example:) line_break = '<span class="text-white">\</span>' <<~BASH.html_safe #{example.to_curl_lines.join(" #{line_break}\n")} # #{example.response.status} #{Rack::Utils::HTTP_STATUS_CODES[example.response.status]} #{JSON.pretty_generate(example.response.data)} BASH end |
#type_attribute_render(name:, type:) ⇒ Object
9 10 11 |
# File 'app/helpers/explicit/application_helper.rb', line 9 def type_attribute_render(name:, type:) render partial: "explicit/documentation/attribute", locals: { name:, type: } end |
#type_constraint(name, value) ⇒ Object
17 18 19 20 21 |
# File 'app/helpers/explicit/application_helper.rb', line 17 def type_constraint(name, value) content_tag(:div, class: "bg-neutral-200 px-1 text-sm") do content_tag(:span, name) + " " + content_tag(:span, value) end end |
#type_constraints(&block) ⇒ Object
13 14 15 |
# File 'app/helpers/explicit/application_helper.rb', line 13 def type_constraints(&block) content_tag(:div, class: "flex flex-wrap gap-2", &block) end |
#type_has_details?(type) ⇒ Boolean
23 24 25 |
# File 'app/helpers/explicit/application_helper.rb', line 23 def type_has_details?(type) type.description.present? || type.has_details? end |
#type_render(type) ⇒ Object
5 6 7 |
# File 'app/helpers/explicit/application_helper.rb', line 5 def type_render(type) render partial: type.partial, locals: { type: } end |