bbcode, doc parsing, render msword documents

This commit is contained in:
Dylan Knutson
2025-02-22 07:43:01 +00:00
parent b470d1a669
commit a2813ca125
32 changed files with 2520 additions and 101 deletions

View File

@@ -54,7 +54,8 @@ RUN \
zlib1g-dev \
watchman \
ffmpeg \
ffmpegthumbnailer
ffmpegthumbnailer \
abiword
# Install postgres 15 client
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \

View File

@@ -65,6 +65,10 @@ services:
volumes:
- devcontainer-redux-grafana-data:/var/lib/grafana
unoconv:
image: unoconv/unoserver-docker
restart: unless-stopped
volumes:
postgres-data:
postgres-data-tablespaces:

View File

@@ -58,7 +58,9 @@ RUN \
gnupg \
nodejs \
libpq-dev \
ffmpeg ffmpegthumbnailer
ffmpeg \
ffmpegthumbnailer \
abiword
COPY --from=native-gems /usr/src/app/gems/xdiff-rb /gems/xdiff-rb
COPY --from=native-gems /usr/src/app/gems/rb-bsdiff /gems/rb-bsdiff

View File

@@ -128,6 +128,8 @@ gem "ruby-vips"
gem "table_print"
gem "zstd-ruby"
gem "rouge"
gem "docx"
gem "ruby-bbcode"
# gem "pghero", git: "https://github.com/dymk/pghero", ref: "e314f99"
gem "pghero", "~> 3.6"

View File

@@ -150,6 +150,9 @@ GEM
disco (0.5.1)
libmf (>= 0.4)
numo-narray (>= 0.9.2)
docx (0.8.0)
nokogiri (~> 1.13, >= 1.13.0)
rubyzip (~> 2.0)
domain_name (0.6.20240107)
drb (2.2.1)
erubi (1.13.1)
@@ -416,6 +419,8 @@ GEM
rspec-sorbet (1.9.2)
sorbet-runtime
rspec-support (3.13.2)
ruby-bbcode (2.1.1)
activesupport (>= 4.2.2)
ruby-prof (1.7.1)
ruby-prof-speedscope (0.3.0)
ruby-prof (~> 1.0)
@@ -557,6 +562,7 @@ DEPENDENCIES
diffy
discard
disco
docx
factory_bot_rails
faiss
good_job (~> 4.6)
@@ -594,6 +600,7 @@ DEPENDENCIES
rouge
rspec-rails (~> 7.0)
rspec-sorbet
ruby-bbcode
ruby-prof
ruby-prof-speedscope
ruby-vips

View File

@@ -23,5 +23,7 @@
- [ ] FA user favs job should stop when in incremental mode when all posts on the page are already known favs (e.g. pages with only 47 posts are not a false positive)
- [x] Factor out FA listings page enqueue logic into common location; use in Gallery and Favs jobs
- [ ] Add followers / following to FA user show page
- [ ] Parse E621 source url for inkbunny posts & users
- [ ] Parse E621 source url for fa users
- [x] Parse E621 source url for inkbunny posts & users
- [x] Parse E621 source url for fa users
- [ ] Parse BBCode in post descriptions
- example post with bbcode: https://refurrer.com/posts/ib/3452498

View File

@@ -108,23 +108,25 @@ module Domain::PostsHelper
ct =
case content_type
when %r{text/plain}
"Text"
"Text Document"
when %r{application/pdf}
"PDF"
"PDF Document"
when %r{image/jpeg}
"JPEG"
"JPEG Image"
when %r{image/png}
"PNG"
"PNG Image"
when %r{image/gif}
"GIF"
"GIF Image"
when %r{video/webm}
"WEBM"
"Webm Video"
when %r{audio/mpeg}
"MP3"
"MP3 Audio"
when %r{audio/mp3}
"MP3"
"MP3 Audio"
when %r{audio/wav}
"WAV"
"WAV Audio"
when %r{application/msword}
"Microsoft Word Document"
else
content_type.split(";").first&.split("/")&.last&.titleize
end

View File

@@ -1,6 +1,9 @@
# typed: strict
module LogEntriesHelper
extend T::Sig
extend T::Helpers
include HelpersInterface
abstract!
sig { params(content_type: String).returns(T::Boolean) }
def is_send_data_content_type?(content_type)
@@ -81,4 +84,54 @@ module LogEntriesHelper
is_renderable_video_type?(content_type) ||
is_renderable_image_type?(content_type)
end
sig { params(log_entry: HttpLogEntry).returns(T.nilable(String)) }
def render_msword_content(log_entry)
docx_body = log_entry.response&.contents
return nil if docx_body.blank?
# Invoke abiword to convert doc / docx to html
# Run abiword conversion with pipes
stdin, stdout, wait_thr =
Open3.popen2(
"abiword",
"--display=0",
"--to=html",
"--to-name=fd://1",
"fd://0",
)
stdin.binmode
stdin.write(docx_body)
stdin.close
stdout_str = stdout.read
exit_status = T.cast(wait_thr.value, Process::Status)
return nil unless exit_status.success?
stdout_str.gsub!(/Abiword HTML Document/, "")
stdout_str = T.cast(T.unsafe(stdout_str).bbcode_to_html(false), String)
stdout_str.gsub!(%r{<br\s*/>}, "")
sanitizer =
Sanitize.new(
elements: %w[span div p i b strong em],
attributes: {
"span" => %w[style],
"div" => %w[style],
"p" => %w[style],
"b" => %w[style],
"i" => %w[style],
"strong" => %w[style],
"em" => %w[style],
},
css: {
properties: %w[font-size color text-align margin-bottom],
},
)
raw sanitizer.fragment(stdout_str)
ensure
stdin&.close
stdout&.close
end
end

View File

@@ -23,53 +23,7 @@
</section>
<div class="mx-auto flex flex-wrap justify-center">
<% @post_group.posts.each do |post| %>
<div class="m-4 flex h-fit flex-col rounded-lg border border-slate-300 bg-slate-50 shadow-sm">
<div class="flex justify-between border-b border-slate-300 p-4">
<div>
<%= render partial: "domain/posts/inline_postable_domain_link", locals: { post: post } %>
</div>
<div>
<% if creator = post.primary_creator_for_view %>
<%= link_to creator.name_for_view,
domain_user_path(creator),
class: "text-blue-600 hover:text-blue-800" %>
<% elsif fallback = post.primary_creator_name_fallback_for_view %>
<%= fallback %>
<% else %>
(nobody)
<% end %>
</div>
</div>
<div class="flex items-center justify-center p-4">
<% if thumbnail_file = gallery_file_for_post(post) %>
<%= link_to domain_post_path(post) do %>
<%= image_tag blob_path(
HexUtil.bin2hex(thumbnail_file.log_entry.response_sha256),
format: "jpg",
thumb: "small",
),
class: "max-h-[300px] max-w-[300px] rounded-md border border-slate-300 object-contain shadow-md",
alt: post.title %>
<% end %>
<% else %>
<span>No file available</span>
<% end %>
</div>
<div class="border-t border-slate-300">
<h2 class="p-4 text-center text-lg">
<%= link_to post.title, domain_post_path(post), class: "sky-link" %>
</h2>
<div class="px-4 pb-4 text-sm text-slate-500">
<div class="flex justify-end">
<% if post.posted_at %>
Posted <%= time_ago_in_words(post.posted_at) %> ago
<% else %>
Post date unknown
<% end %>
</div>
</div>
</div>
</div>
<%= render "domain/posts/as_gallery_item", post: post %>
<% end %>
</div>
</div>

View File

@@ -3,7 +3,7 @@
>
<div class="flex justify-between border-b border-slate-300 p-4">
<div>
<%= render partial: "inline_postable_domain_link", locals: { post: post } %>
<%= render "domain/posts/inline_postable_domain_link", post: post %>
</div>
<% if @user.nil?%>
<div>

View File

@@ -1,44 +1,18 @@
<% path = blob_path(HexUtil.bin2hex(log_entry.response_sha256)) %>
<section class="flex grow justify-center overflow-clip">
<% if is_renderable_image_type?(log_entry.content_type) %>
<img alt="image" src="<%= path %>" class="md:rounded-md" />
<%= render partial: "log_entries/renderers/image", locals: { log_entry:, path: } %>
<% elsif is_renderable_audio_type?(log_entry.content_type) %>
<audio controls class="md:rounded-md w-full" src="<%= path %>"></audio>
<%= render partial: "log_entries/renderers/audio", locals: { log_entry:, path: } %>
<% elsif is_renderable_video_type?(log_entry.content_type) %>
<video
class="md:rounded-md w-full"
alt="video"
controls="controls"
loop="loop"
src="<%= path %>"
></video>
<%= render partial: "log_entries/renderers/video", locals: { log_entry:, path: } %>
<% elsif is_flash_content_type?(log_entry.content_type) %>
<embed alt="embed" type="<%= log_entry.content_type %>" src="<%= path %>" />
<%= render partial: "log_entries/renderers/embed", locals: { log_entry:, path: } %>
<% elsif is_json_content_type?(log_entry.content_type) %>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/10.1.2/jsoneditor-minimalist.js" integrity="sha512-nE5Fvsy9rTqI8XmarA3NcrUaueECbWRlgTTMdUwDC8okoc0HbObAeRTMsGH2qHxf4fYFOgErgkJSRmN7BUklCA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/10.1.2/jsoneditor.min.css" integrity="sha512-8G+Vb2+10BSrSo+wupdzJIylDLpGtEYniQhp0rsbTigPG7Onn2S08Ai/KEGlxN2Ncx9fGqVHtRehMuOjPb9f8g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<div id="jsoneditor" class="w-full h-full p-4"></div>
<script>
const container = document.getElementById('jsoneditor');
const options = {
mode: 'view',
theme: 'ace/theme/monokai/dark',
};
const content_url = "<%= path %>";
const editor = new JSONEditor(container, options);
fetch(content_url).then(response => response.json()).then(data => {
editor.set(data);
editor.expandAll();
}).catch(error => {
container.innerHTML = "Error loading JSON: " + error;
})
</script>
<%= render partial: "log_entries/renderers/json", locals: { log_entry:, path: } %>
<% elsif log_entry.content_type =~ %r{application/msword} %>
<%= render partial: "log_entries/renderers/msword", locals: { log_entry:, path: } %>
<% else %>
<iframe
sandbox
title="log entry contents"
referrerpolicy="no-referrer"
src="<%= path %>"
></iframe>
<%= render partial: "log_entries/renderers/iframe_fallback", locals: { log_entry:, path: } %>
<% end %>
</section>

View File

@@ -0,0 +1 @@
<audio controls class="md:rounded-md w-full" src="<%= path %>"></audio>

View File

@@ -0,0 +1 @@
<embed alt="embed" type="<%= log_entry.content_type %>" src="<%= path %>" />

View File

@@ -0,0 +1,6 @@
<iframe
sandbox
title="log entry contents"
referrerpolicy="no-referrer"
src="<%= path %>"
></iframe>

View File

@@ -0,0 +1 @@
<img alt="image" src="<%= path %>" class="md:rounded-md" />

View File

@@ -0,0 +1,18 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/10.1.2/jsoneditor-minimalist.js" integrity="sha512-nE5Fvsy9rTqI8XmarA3NcrUaueECbWRlgTTMdUwDC8okoc0HbObAeRTMsGH2qHxf4fYFOgErgkJSRmN7BUklCA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/10.1.2/jsoneditor.min.css" integrity="sha512-8G+Vb2+10BSrSo+wupdzJIylDLpGtEYniQhp0rsbTigPG7Onn2S08Ai/KEGlxN2Ncx9fGqVHtRehMuOjPb9f8g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<div id="jsoneditor" class="w-full h-full p-4"></div>
<script>
const container = document.getElementById('jsoneditor');
const options = {
mode: 'view',
theme: 'ace/theme/monokai/dark',
};
const content_url = "<%= path %>";
const editor = new JSONEditor(container, options);
fetch(content_url).then(response => response.json()).then(data => {
editor.set(data);
editor.expandAll();
}).catch(error => {
container.innerHTML = "Error loading JSON: " + error;
})
</script>

View File

@@ -0,0 +1,30 @@
<section class="sky-section w-full">
<div class="section-header flex justify-between items-center sticky z-10 py-2 border-b">
<span>Word Document</span>
<button onclick="toggleMsWordContent()" id="msword-toggle" class="text-sm text-blue-600 hover:text-blue-800 flex items-center gap-1">
<span>Show More</span>
<i id="msword-toggle-icon" class="fa-solid fa-chevron-down w-4 h-4"></i>
</button>
</div>
<div class="bg-slate-100 p-4 indent-4 font-medium font-serif">
<div id="msword-content" class="line-clamp-6">
<%= render_msword_content(log_entry) %>
</div>
<script>
function toggleMsWordContent() {
const content = document.getElementById('msword-content');
const button = document.getElementById('msword-toggle');
const icon = document.getElementById('msword-toggle-icon');
if (content.classList.contains('line-clamp-6')) {
content.classList.remove('line-clamp-6');
button.firstElementChild.textContent = 'Show Less';
icon.style.transform = 'rotate(180deg)';
} else {
content.classList.add('line-clamp-6');
button.firstElementChild.textContent = 'Show More';
icon.style.transform = 'rotate(0deg)';
}
}
</script>
</div>
</section>

View File

@@ -0,0 +1,7 @@
<video
class="md:rounded-md w-full"
alt="video"
controls="controls"
loop="loop"
src="<%= path %>"
></video>

View File

@@ -37,8 +37,8 @@ class ApplicationController
include ::Domain::PaginationHelper
include ::Domain::PostGroupsHelper
include ::LogEntriesHelper
include ::Domain::PostsHelper
include ::Domain::UsersHelper
include ::Domain::PostsHelper
include ::DomainSourceHelper
include ::GoodJobHelper
include ::IndexablePostsHelper

View File

@@ -34,8 +34,8 @@ class DeviseController
include ::Domain::PaginationHelper
include ::Domain::PostGroupsHelper
include ::LogEntriesHelper
include ::Domain::PostsHelper
include ::Domain::UsersHelper
include ::Domain::PostsHelper
include ::DomainSourceHelper
include ::GoodJobHelper
include ::IndexablePostsHelper

View File

@@ -27,8 +27,8 @@ class GoodJob::JobsController
include ::GoodJob::ApplicationController::HelperMethods
include ::HelpersInterface
include ::LogEntriesHelper
include ::Domain::PostsHelper
include ::Domain::UsersHelper
include ::Domain::PostsHelper
include ::Domain::PostGroupsHelper
include ::GoodJobHelper
end

View File

@@ -37,8 +37,8 @@ class Rails::ApplicationController
include ::Domain::PaginationHelper
include ::Domain::PostGroupsHelper
include ::LogEntriesHelper
include ::Domain::PostsHelper
include ::Domain::UsersHelper
include ::Domain::PostsHelper
include ::DomainSourceHelper
include ::GoodJobHelper
include ::IndexablePostsHelper

View File

@@ -37,8 +37,8 @@ class Rails::Conductor::BaseController
include ::Domain::PaginationHelper
include ::Domain::PostGroupsHelper
include ::LogEntriesHelper
include ::Domain::PostsHelper
include ::Domain::UsersHelper
include ::Domain::PostsHelper
include ::DomainSourceHelper
include ::GoodJobHelper
include ::IndexablePostsHelper

View File

@@ -37,8 +37,8 @@ class Rails::HealthController
include ::Domain::PaginationHelper
include ::Domain::PostGroupsHelper
include ::LogEntriesHelper
include ::Domain::PostsHelper
include ::Domain::UsersHelper
include ::Domain::PostsHelper
include ::DomainSourceHelper
include ::GoodJobHelper
include ::IndexablePostsHelper

658
sorbet/rbi/gems/docx@0.8.0.rbi generated Normal file
View File

@@ -0,0 +1,658 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `docx` gem.
# Please instead update this file by running `bin/tapioca gem docx`.
# source://docx//lib/docx/version.rb#3
module Docx; end
# The Document class wraps around a docx file and provides methods to
# interface with it.
#
# # get a Docx::Document for a docx file in the local directory
# doc = Docx::Document.open("test.docx")
#
# # get the text from the document
# puts doc.text
#
# # do the same thing in a block
# Docx::Document.open("test.docx") do |d|
# puts d.text
# end
#
# source://docx//lib/docx/document.rb#20
class Docx::Document
# @return [Document] a new instance of Document
#
# source://docx//lib/docx/document.rb#23
def initialize(path_or_io, options = T.unsafe(nil)); end
# source://docx//lib/docx/document.rb#64
def bookmarks; end
# Returns the value of attribute doc.
#
# source://docx//lib/docx/document.rb#21
def doc; end
# This stores the current global document properties, for now
#
# source://docx//lib/docx/document.rb#45
def document_properties; end
# *Deprecated*
#
# Iterates over paragraphs within document
# call-seq:
# each_paragraph => Enumerator
#
# source://docx//lib/docx/document.rb#107
def each_paragraph; end
# Some documents have this set, others don't.
# Values are returned as half-points, so to get points, that's why it's divided by 2.
#
# source://docx//lib/docx/document.rb#83
def font_size; end
# source://docx//lib/docx/document.rb#97
def hyperlink_relationships; end
# Hyperlink targets are extracted from the document.xml.rels file
#
# source://docx//lib/docx/document.rb#91
def hyperlinks; end
# source://docx//lib/docx/document.rb#60
def paragraphs; end
# source://docx//lib/docx/document.rb#166
def replace_entry(entry_path, file_contents); end
# Save document to provided path
# call-seq:
# save(filepath) => void
#
# source://docx//lib/docx/document.rb#125
def save(path); end
# Output entire document as a StringIO object
#
# source://docx//lib/docx/document.rb#144
def stream; end
# Returns the value of attribute styles.
#
# source://docx//lib/docx/document.rb#21
def styles; end
# source://docx//lib/docx/document.rb#77
def tables; end
# call-seq:
# to_s -> string
#
# source://docx//lib/docx/document.rb#113
def text; end
# Output entire document as a String HTML fragment
#
# source://docx//lib/docx/document.rb#118
def to_html; end
# call-seq:
# to_s -> string
#
# source://docx//lib/docx/document.rb#113
def to_s; end
# source://docx//lib/docx/document.rb#73
def to_xml; end
# Returns the value of attribute xml.
#
# source://docx//lib/docx/document.rb#21
def xml; end
# Returns the value of attribute zip.
#
# source://docx//lib/docx/document.rb#21
def zip; end
private
# @raise [Errno::ENOENT]
#
# source://docx//lib/docx/document.rb#181
def load_rels; end
# source://docx//lib/docx/document.rb#172
def load_styles; end
# generate Elements::Bookmark from bookmark XML node
#
# source://docx//lib/docx/document.rb#204
def parse_bookmark_from(b_node); end
# generate Elements::Containers::Paragraph from paragraph XML node
#
# source://docx//lib/docx/document.rb#199
def parse_paragraph_from(p_node); end
# source://docx//lib/docx/document.rb#208
def parse_table_from(t_node); end
# --
# TODO: Flesh this out to be compatible with other files
# TODO: Method to set flag on files that have been edited, probably by inserting something at the
# end of methods that make edits?
# ++
#
# source://docx//lib/docx/document.rb#194
def update; end
class << self
# With no associated block, Docx::Document.open is a synonym for Docx::Document.new. If the optional code block is given, it will be passed the opened +docx+ file as an argument and the Docx::Document oject will automatically be closed when the block terminates. The values of the block will be returned from Docx::Document.open.
# call-seq:
# open(filepath) => file
# open(filepath) {|file| block } => obj
#
# source://docx//lib/docx/document.rb#56
def open(path, &block); end
end
end
# source://docx//lib/docx/elements/element.rb#6
module Docx::Elements; end
# source://docx//lib/docx/elements/bookmark.rb#5
class Docx::Elements::Bookmark
include ::Docx::Elements::Element
extend ::Docx::Elements::Element::ClassMethods
# @return [Bookmark] a new instance of Bookmark
#
# source://docx//lib/docx/elements/bookmark.rb#13
def initialize(node); end
# Get text run immediately after bookmark node
#
# source://docx//lib/docx/elements/bookmark.rb#68
def get_run_after; end
# Get text run immediately prior to bookmark node
#
# source://docx//lib/docx/elements/bookmark.rb#53
def get_run_before; end
# insert multiple lines starting with paragraph containing bookmark node.
#
# source://docx//lib/docx/elements/bookmark.rb#31
def insert_multiple_lines(text_array); end
# Insert text after bookmarkStart node
#
# source://docx//lib/docx/elements/bookmark.rb#25
def insert_text_after(text); end
# Insert text before bookmarkStart node
#
# source://docx//lib/docx/elements/bookmark.rb#19
def insert_text_before(text); end
# Returns the value of attribute name.
#
# source://docx//lib/docx/elements/bookmark.rb#7
def name; end
# Sets the attribute name
#
# @param value the value to set the attribute name to.
#
# source://docx//lib/docx/elements/bookmark.rb#7
def name=(_arg0); end
class << self
# source://docx//lib/docx/elements/bookmark.rb#9
def tag; end
end
end
# source://docx//lib/docx/elements/element.rb#13
Docx::Elements::Bookmark::TAG = T.let(T.unsafe(nil), String)
# source://docx//lib/docx/containers/container.rb#5
module Docx::Elements::Containers; end
# source://docx//lib/docx/containers/container.rb#6
module Docx::Elements::Containers::Container
# Erase text within an element
#
# source://docx//lib/docx/containers/container.rb#14
def blank!; end
# Relation methods
# TODO: Create a properties object, include Element
#
# source://docx//lib/docx/containers/container.rb#9
def properties; end
# source://docx//lib/docx/containers/container.rb#18
def remove!; end
end
# source://docx//lib/docx/containers/paragraph.rb#7
class Docx::Elements::Containers::Paragraph
include ::Docx::Elements::Containers::Container
include ::Docx::Elements::Element
extend ::Docx::Elements::Element::ClassMethods
# Child elements: pPr, r, fldSimple, hlink, subDoc
# http://msdn.microsoft.com/en-us/library/office/ee364458(v=office.11).aspx
#
# @return [Paragraph] a new instance of Paragraph
#
# source://docx//lib/docx/containers/paragraph.rb#18
def initialize(node, document_properties = T.unsafe(nil)); end
# @return [Boolean]
#
# source://docx//lib/docx/containers/paragraph.rb#74
def aligned_center?; end
# @return [Boolean]
#
# source://docx//lib/docx/containers/paragraph.rb#66
def aligned_left?; end
# @return [Boolean]
#
# source://docx//lib/docx/containers/paragraph.rb#70
def aligned_right?; end
# Iterate over each text run within a paragraph
#
# source://docx//lib/docx/containers/paragraph.rb#62
def each_text_run; end
# source://docx//lib/docx/containers/paragraph.rb#78
def font_size; end
# Return text of paragraph
#
# source://docx//lib/docx/containers/paragraph.rb#40
def text; end
# Set text of paragraph
#
# source://docx//lib/docx/containers/paragraph.rb#26
def text=(content); end
# Array of text runs contained within paragraph
#
# source://docx//lib/docx/containers/paragraph.rb#57
def text_runs; end
# Return paragraph as a <p></p> HTML fragment with formatting based on properties.
#
# source://docx//lib/docx/containers/paragraph.rb#45
def to_html; end
# Return text of paragraph
#
# source://docx//lib/docx/containers/paragraph.rb#40
def to_s; end
private
# Returns the alignment if any, or nil if left
#
# source://docx//lib/docx/containers/paragraph.rb#88
def alignment; end
class << self
# source://docx//lib/docx/containers/paragraph.rb#11
def tag; end
end
end
# source://docx//lib/docx/elements/element.rb#13
Docx::Elements::Containers::Paragraph::TAG = T.let(T.unsafe(nil), String)
# source://docx//lib/docx/containers/table.rb#8
class Docx::Elements::Containers::Table
include ::Docx::Elements::Containers::Container
include ::Docx::Elements::Element
extend ::Docx::Elements::Element::ClassMethods
# @return [Table] a new instance of Table
#
# source://docx//lib/docx/containers/table.rb#16
def initialize(node); end
# source://docx//lib/docx/containers/table.rb#39
def column_count; end
# Array of column
#
# source://docx//lib/docx/containers/table.rb#31
def columns; end
# Iterate over each row within a table
#
# source://docx//lib/docx/containers/table.rb#44
def each_rows; end
# source://docx//lib/docx/containers/table.rb#26
def row_count; end
# Array of row
#
# source://docx//lib/docx/containers/table.rb#22
def rows; end
class << self
# source://docx//lib/docx/containers/table.rb#12
def tag; end
end
end
# source://docx//lib/docx/elements/element.rb#13
Docx::Elements::Containers::Table::TAG = T.let(T.unsafe(nil), String)
# source://docx//lib/docx/containers/table_cell.rb#7
class Docx::Elements::Containers::TableCell
include ::Docx::Elements::Containers::Container
include ::Docx::Elements::Element
extend ::Docx::Elements::Element::ClassMethods
# @return [TableCell] a new instance of TableCell
#
# source://docx//lib/docx/containers/table_cell.rb#15
def initialize(node); end
# Iterate over each text run within a paragraph's cell
#
# source://docx//lib/docx/containers/table_cell.rb#31
def each_paragraph; end
# Array of paragraphs contained within cell
#
# source://docx//lib/docx/containers/table_cell.rb#26
def paragraphs; end
# Return text of paragraph's cell
#
# source://docx//lib/docx/containers/table_cell.rb#21
def text; end
# Return text of paragraph's cell
#
# source://docx//lib/docx/containers/table_cell.rb#21
def to_s; end
class << self
# source://docx//lib/docx/containers/table_cell.rb#11
def tag; end
end
end
# source://docx//lib/docx/elements/element.rb#13
Docx::Elements::Containers::TableCell::TAG = T.let(T.unsafe(nil), String)
# source://docx//lib/docx/containers/table_column.rb#7
class Docx::Elements::Containers::TableColumn
include ::Docx::Elements::Containers::Container
include ::Docx::Elements::Element
extend ::Docx::Elements::Element::ClassMethods
# @return [TableColumn] a new instance of TableColumn
#
# source://docx//lib/docx/containers/table_column.rb#15
def initialize(cell_nodes); end
# Array of cells contained within row
#
# source://docx//lib/docx/containers/table_column.rb#22
def cells; end
class << self
# source://docx//lib/docx/containers/table_column.rb#11
def tag; end
end
end
# source://docx//lib/docx/elements/element.rb#13
Docx::Elements::Containers::TableColumn::TAG = T.let(T.unsafe(nil), String)
# source://docx//lib/docx/containers/table_row.rb#7
class Docx::Elements::Containers::TableRow
include ::Docx::Elements::Containers::Container
include ::Docx::Elements::Element
extend ::Docx::Elements::Element::ClassMethods
# @return [TableRow] a new instance of TableRow
#
# source://docx//lib/docx/containers/table_row.rb#15
def initialize(node); end
# Array of cells contained within row
#
# source://docx//lib/docx/containers/table_row.rb#21
def cells; end
class << self
# source://docx//lib/docx/containers/table_row.rb#11
def tag; end
end
end
# source://docx//lib/docx/elements/element.rb#13
Docx::Elements::Containers::TableRow::TAG = T.let(T.unsafe(nil), String)
# source://docx//lib/docx/containers/text_run.rb#6
class Docx::Elements::Containers::TextRun
include ::Docx::Elements::Containers::Container
include ::Docx::Elements::Element
extend ::Docx::Elements::Element::ClassMethods
# @return [TextRun] a new instance of TextRun
#
# source://docx//lib/docx/containers/text_run.rb#23
def initialize(node, document_properties = T.unsafe(nil)); end
# @return [Boolean]
#
# source://docx//lib/docx/containers/text_run.rb#89
def bolded?; end
# source://docx//lib/docx/containers/text_run.rb#109
def font_size; end
# Returns the value of attribute formatting.
#
# source://docx//lib/docx/containers/text_run.rb#21
def formatting; end
# source://docx//lib/docx/containers/text_run.rb#101
def href; end
# @return [Boolean]
#
# source://docx//lib/docx/containers/text_run.rb#97
def hyperlink?; end
# source://docx//lib/docx/containers/text_run.rb#105
def hyperlink_id; end
# @return [Boolean]
#
# source://docx//lib/docx/containers/text_run.rb#85
def italicized?; end
# source://docx//lib/docx/containers/text_run.rb#59
def parse_formatting; end
# Returns text contained within text run
#
# source://docx//lib/docx/containers/text_run.rb#47
def parse_text; end
# Substitute text in text @text_nodes
#
# source://docx//lib/docx/containers/text_run.rb#52
def substitute(match, replacement); end
# Returns the value of attribute text.
#
# source://docx//lib/docx/containers/text_run.rb#20
def text; end
# Set text of text run
#
# source://docx//lib/docx/containers/text_run.rb#36
def text=(content); end
# Return text as a HTML fragment with formatting based on properties.
#
# source://docx//lib/docx/containers/text_run.rb#72
def to_html; end
# source://docx//lib/docx/containers/text_run.rb#67
def to_s; end
# @return [Boolean]
#
# source://docx//lib/docx/containers/text_run.rb#93
def underlined?; end
private
# source://docx//lib/docx/containers/text_run.rb#116
def reset_text; end
class << self
# source://docx//lib/docx/containers/text_run.rb#16
def tag; end
end
end
# source://docx//lib/docx/containers/text_run.rb#10
Docx::Elements::Containers::TextRun::DEFAULT_FORMATTING = T.let(T.unsafe(nil), Hash)
# source://docx//lib/docx/elements/element.rb#13
Docx::Elements::Containers::TextRun::TAG = T.let(T.unsafe(nil), String)
# source://docx//lib/docx/elements/element.rb#7
module Docx::Elements::Element
mixes_in_class_methods ::Docx::Elements::Element::ClassMethods
# Insertion methods
# Insert node as last child
#
# source://docx//lib/docx/elements/element.rb#38
def append_to(element); end
# source://docx//lib/docx/elements/element.rb#23
def at_xpath(*args); end
# Creation/edit methods
#
# source://docx//lib/docx/elements/element.rb#61
def copy; end
# A method to wrap content in an HTML tag.
# Currently used in paragraph and text_run for the to_html methods
#
# content:: The base text content for the tag.
# styles:: Hash of the inline CSS styles to be applied. e.g.
# { 'font-size' => '12pt', 'text-decoration' => 'underline' }
#
# source://docx//lib/docx/elements/element.rb#72
def html_tag(name, options = T.unsafe(nil)); end
# source://docx//lib/docx/elements/element.rb#49
def insert_after(element); end
# source://docx//lib/docx/elements/element.rb#55
def insert_before(element); end
# Returns the value of attribute node.
#
# source://docx//lib/docx/elements/element.rb#16
def node; end
# Sets the attribute node
#
# @param value the value to set the attribute node to.
#
# source://docx//lib/docx/elements/element.rb#16
def node=(_arg0); end
# TODO: Should create a docx object from this
#
# source://docx//lib/docx/elements/element.rb#19
def parent(type = T.unsafe(nil)); end
# Get parent paragraph of element
#
# source://docx//lib/docx/elements/element.rb#32
def parent_paragraph; end
# Insert node as first child (after properties)
#
# source://docx//lib/docx/elements/element.rb#44
def prepend_to(element); end
# source://docx//lib/docx/elements/element.rb#27
def xpath(*args); end
class << self
# Ensure that a 'tag' corresponding to the XML element that defines the element is defined
#
# source://docx//lib/docx/elements/element.rb#11
def included(base); end
end
end
# source://docx//lib/docx/elements/element.rb#98
module Docx::Elements::Element::ClassMethods
# source://docx//lib/docx/elements/element.rb#99
def create_with(element); end
# source://docx//lib/docx/elements/element.rb#104
def create_within(element); end
end
# source://docx//lib/docx/elements/element.rb#8
Docx::Elements::Element::DEFAULT_TAG = T.let(T.unsafe(nil), String)
# source://docx//lib/docx/elements/text.rb#3
class Docx::Elements::Text
include ::Docx::Elements::Element
extend ::Docx::Elements::Element::ClassMethods
# @return [Text] a new instance of Text
#
# source://docx//lib/docx/elements/text.rb#18
def initialize(node); end
# source://docx//lib/docx/elements/text.rb#10
def content; end
# source://docx//lib/docx/elements/text.rb#14
def content=(args); end
class << self
# source://docx//lib/docx/elements/text.rb#6
def tag; end
end
end
# source://docx//lib/docx/elements/element.rb#13
Docx::Elements::Text::TAG = T.let(T.unsafe(nil), String)
# source://docx//lib/docx/version.rb#4
Docx::VERSION = T.let(T.unsafe(nil), String)

185
sorbet/rbi/gems/ffi-compiler@1.3.2.rbi generated Normal file
View File

@@ -0,0 +1,185 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `ffi-compiler` gem.
# Please instead update this file by running `bin/tapioca gem ffi-compiler`.
# source://ffi-compiler//lib/ffi-compiler/loader.rb#5
module FFI
private
def custom_typedefs; end
class << self
def _async_cb_dispatcher_atfork_child; end
# source://ffi/1.17.1/lib/ffi/types.rb#62
def add_typedef(old, add); end
# source://ffi/1.17.1/lib/ffi/errno.rb#34
def errno; end
# source://ffi/1.17.1/lib/ffi/errno.rb#40
def errno=(error); end
# @raise [TypeError]
#
# source://ffi/1.17.1/lib/ffi/types.rb#76
def find_type(name, type_map = T.unsafe(nil)); end
# source://ffi/1.17.1/lib/ffi/compat.rb#35
def make_shareable(obj); end
# source://ffi/1.17.1/lib/ffi/library.rb#46
def map_library_name(lib); end
# source://ffi/1.17.1/lib/ffi/types.rb#101
def type_size(type); end
# source://ffi/1.17.1/lib/ffi/types.rb#56
def typedef(old, add); end
private
# source://ffi/1.17.1/lib/ffi/types.rb#66
def __typedef(old, add); end
def custom_typedefs; end
end
end
class FFI::ArrayType < ::FFI::Type
def initialize(_arg0, _arg1); end
def elem_type; end
def length; end
end
class FFI::Buffer < ::FFI::AbstractMemory
def initialize(*_arg0); end
def +(_arg0); end
def inspect; end
def length; end
def order(*_arg0); end
def slice(_arg0, _arg1); end
private
def initialize_copy(_arg0); end
class << self
def alloc_in(*_arg0); end
def alloc_inout(*_arg0); end
def alloc_out(*_arg0); end
def new_in(*_arg0); end
def new_inout(*_arg0); end
def new_out(*_arg0); end
end
end
# source://ffi-compiler//lib/ffi-compiler/platform.rb#1
module FFI::Compiler; end
# source://ffi-compiler//lib/ffi-compiler/loader.rb#7
module FFI::Compiler::Loader
class << self
# source://ffi-compiler//lib/ffi-compiler/loader.rb#28
def caller_path(line = T.unsafe(nil)); end
# @raise [LoadError]
#
# source://ffi-compiler//lib/ffi-compiler/loader.rb#8
def find(name, start_path = T.unsafe(nil)); end
end
end
# source://ffi-compiler//lib/ffi-compiler/platform.rb#2
class FFI::Compiler::Platform
# source://ffi-compiler//lib/ffi-compiler/platform.rb#13
def arch; end
# @return [Boolean]
#
# source://ffi-compiler//lib/ffi-compiler/platform.rb#25
def mac?; end
# source://ffi-compiler//lib/ffi-compiler/platform.rb#9
def map_library_name(name); end
# source://ffi-compiler//lib/ffi-compiler/platform.rb#21
def name; end
# source://ffi-compiler//lib/ffi-compiler/platform.rb#17
def os; end
class << self
# source://ffi-compiler//lib/ffi-compiler/platform.rb#5
def system; end
end
end
# source://ffi-compiler//lib/ffi-compiler/platform.rb#3
FFI::Compiler::Platform::LIBSUFFIX = T.let(T.unsafe(nil), String)
class FFI::FunctionType < ::FFI::Type
def initialize(*_arg0); end
def param_types; end
def return_type; end
end
module FFI::LastError
private
def error; end
def error=(_arg0); end
class << self
def error; end
def error=(_arg0); end
end
end
class FFI::MemoryPointer < ::FFI::Pointer
def initialize(*_arg0); end
class << self
def from_string(_arg0); end
end
end
module FFI::NativeType; end
class FFI::NullPointerError < ::RuntimeError; end
class FFI::StructByValue < ::FFI::Type
# @return [StructByValue] a new instance of StructByValue
def initialize(_arg0); end
def layout; end
def struct_class; end
end
class FFI::Type
# @return [Type] a new instance of Type
def initialize(_arg0); end
def alignment; end
def inspect; end
def size; end
end
class FFI::Type::Builtin < ::FFI::Type
def inspect; end
end
class FFI::Type::Mapped < ::FFI::Type
def initialize(_arg0); end
def converter; end
def from_native(*_arg0); end
def native_type; end
def to_native(*_arg0); end
def type; end
end

435
sorbet/rbi/gems/http-form_data@2.3.0.rbi generated Normal file
View File

@@ -0,0 +1,435 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `http-form_data` gem.
# Please instead update this file by running `bin/tapioca gem http-form_data`.
# http gem namespace.
#
# @see https://github.com/httprb/http
#
# source://http-form_data//lib/http/form_data/readable.rb#3
module HTTP
class << self
# source://http/5.2.0/lib/http/chainable.rb#182
def [](headers); end
end
end
# Utility-belt to build form data request bodies.
# Provides support for `application/x-www-form-urlencoded` and
# `multipart/form-data` types.
#
# @example Usage
#
# form = FormData.create({
# :username => "ixti",
# :avatar_file => FormData::File.new("/home/ixti/avatar.png")
# })
#
# # Assuming socket is an open socket to some HTTP server
# socket << "POST /some-url HTTP/1.1\r\n"
# socket << "Host: example.com\r\n"
# socket << "Content-Type: #{form.content_type}\r\n"
# socket << "Content-Length: #{form.content_length}\r\n"
# socket << "\r\n"
# socket << form.to_s
#
# source://http-form_data//lib/http/form_data/readable.rb#4
module HTTP::FormData
class << self
# FormData factory. Automatically selects best type depending on given
# `data` Hash.
#
# @param data [#to_h, Hash]
# @return [Multipart] if any of values is a {FormData::File}
# @return [Urlencoded] otherwise
#
# source://http-form_data//lib/http/form_data.rb#44
def create(data, encoder: T.unsafe(nil)); end
# Coerce `obj` to Hash.
#
# @note Internal usage helper, to workaround lack of `#to_h` on Ruby < 2.1
# @raise [Error] `obj` can't be coerced.
# @return [Hash]
#
# source://http-form_data//lib/http/form_data.rb#59
def ensure_hash(obj); end
private
# Tells whenever data contains multipart data or not.
#
# @param data [Hash]
# @return [Boolean]
#
# source://http-form_data//lib/http/form_data.rb#74
def multipart?(data); end
end
end
# CRLF
#
# source://http-form_data//lib/http/form_data.rb#32
HTTP::FormData::CRLF = T.let(T.unsafe(nil), String)
# Provides IO interface across multiple IO objects.
#
# source://http-form_data//lib/http/form_data/composite_io.rb#8
class HTTP::FormData::CompositeIO
# @param ios [Array<IO>] Array of IO objects
# @return [CompositeIO] a new instance of CompositeIO
#
# source://http-form_data//lib/http/form_data/composite_io.rb#10
def initialize(ios); end
# Reads and returns partial content acrosss multiple IO objects.
#
# @param length [Integer] Number of bytes to retrieve
# @param outbuf [String] String to be replaced with retrieved data
# @return [String, nil]
#
# source://http-form_data//lib/http/form_data/composite_io.rb#31
def read(length = T.unsafe(nil), outbuf = T.unsafe(nil)); end
# Rewinds all IO objects and set cursor to the first IO object.
#
# source://http-form_data//lib/http/form_data/composite_io.rb#46
def rewind; end
# Returns sum of all IO sizes.
#
# source://http-form_data//lib/http/form_data/composite_io.rb#41
def size; end
private
# Advances cursor to the next IO object.
#
# source://http-form_data//lib/http/form_data/composite_io.rb#83
def advance_io; end
# Returns IO object under the cursor.
#
# source://http-form_data//lib/http/form_data/composite_io.rb#78
def current_io; end
# Yields chunks with total length up to `length`.
#
# source://http-form_data//lib/http/form_data/composite_io.rb#54
def read_chunks(length = T.unsafe(nil)); end
# Reads chunk from current IO with length up to `max_length`.
#
# source://http-form_data//lib/http/form_data/composite_io.rb#67
def readpartial(max_length = T.unsafe(nil)); end
end
# Generic FormData error.
#
# source://http-form_data//lib/http/form_data.rb#35
class HTTP::FormData::Error < ::StandardError; end
# Represents file form param.
#
# @example Usage with StringIO
#
# io = StringIO.new "foo bar baz"
# FormData::File.new io, :filename => "foobar.txt"
# @example Usage with IO
#
# File.open "/home/ixti/avatar.png" do |io|
# FormData::File.new io
# end
# @example Usage with pathname
#
# FormData::File.new "/home/ixti/avatar.png"
#
# source://http-form_data//lib/http/form_data/file.rb#21
class HTTP::FormData::File < ::HTTP::FormData::Part
# @option opts
# @option opts
# @param path_or_io [String, Pathname, IO] Filename or IO instance.
# @param opts [#to_h]
# @return [File] a new instance of File
# @see DEFAULT_MIME
#
# source://http-form_data//lib/http/form_data/file.rb#36
def initialize(path_or_io, opts = T.unsafe(nil)); end
# @deprecated Use #content_type instead
#
# source://http-form_data//lib/http/form_data/part.rb#18
def mime_type; end
private
# source://http-form_data//lib/http/form_data/file.rb#61
def filename_for(io); end
# source://http-form_data//lib/http/form_data/file.rb#51
def make_io(path_or_io); end
end
# Default MIME type
#
# source://http-form_data//lib/http/form_data/file.rb#23
HTTP::FormData::File::DEFAULT_MIME = T.let(T.unsafe(nil), String)
# `multipart/form-data` form data.
#
# source://http-form_data//lib/http/form_data/multipart/param.rb#8
class HTTP::FormData::Multipart
include ::HTTP::FormData::Readable
# @param data [#to_h, Hash] form data key-value Hash
# @return [Multipart] a new instance of Multipart
#
# source://http-form_data//lib/http/form_data/multipart.rb#18
def initialize(data, boundary: T.unsafe(nil)); end
# Returns the value of attribute boundary.
#
# source://http-form_data//lib/http/form_data/multipart.rb#15
def boundary; end
# Returns form data content size to be used for HTTP request
# `Content-Length` header.
#
# @return [Integer]
#
# source://http-form_data//lib/http/form_data/readable.rb#30
def content_length; end
# Returns MIME type to be used for HTTP request `Content-Type` header.
#
# @return [String]
#
# source://http-form_data//lib/http/form_data/multipart.rb#36
def content_type; end
private
# @return [String]
#
# source://http-form_data//lib/http/form_data/multipart.rb#49
def glue; end
# @return [String]
#
# source://http-form_data//lib/http/form_data/multipart.rb#54
def tail; end
class << self
# Generates a string suitable for using as a boundary in multipart form
# data.
#
# @return [String]
#
# source://http-form_data//lib/http/form_data/multipart.rb#29
def generate_boundary; end
end
end
# Utility class to represent multi-part chunks
#
# source://http-form_data//lib/http/form_data/multipart/param.rb#10
class HTTP::FormData::Multipart::Param
include ::HTTP::FormData::Readable
# Initializes body part with headers and data.
#
# @example With {FormData::File} value
#
# Content-Disposition: form-data; name="avatar"; filename="avatar.png"
# Content-Type: application/octet-stream
#
# ...data of avatar.png...
# @example With non-{FormData::File} value
#
# Content-Disposition: form-data; name="username"
#
# ixti
# @param name [#to_s]
# @param value [FormData::File, FormData::Part, #to_s]
# @return [String]
#
# source://http-form_data//lib/http/form_data/multipart/param.rb#31
def initialize(name, value); end
private
# source://http-form_data//lib/http/form_data/multipart/param.rb#78
def content_type; end
# source://http-form_data//lib/http/form_data/multipart/param.rb#82
def filename; end
# source://http-form_data//lib/http/form_data/multipart/param.rb#86
def footer; end
# source://http-form_data//lib/http/form_data/multipart/param.rb#64
def header; end
# source://http-form_data//lib/http/form_data/multipart/param.rb#72
def parameters; end
class << self
# Flattens given `data` Hash into an array of `Param`'s.
# Nested array are unwinded.
# Behavior is similar to `URL.encode_www_form`.
#
# @param data [Hash]
# @return [Array<FormData::MultiPart::Param>]
#
# source://http-form_data//lib/http/form_data/multipart/param.rb#50
def coerce(data); end
end
end
# Represents a body part of multipart/form-data request.
#
# @example Usage with String
#
# body = "Message"
# FormData::Part.new body, :content_type => 'foobar.txt; charset="UTF-8"'
#
# source://http-form_data//lib/http/form_data/part.rb#15
class HTTP::FormData::Part
include ::HTTP::FormData::Readable
# @param body [#to_s]
# @param content_type [String] Value of Content-Type header
# @param filename [String] Value of filename parameter
# @return [Part] a new instance of Part
#
# source://http-form_data//lib/http/form_data/part.rb#23
def initialize(body, content_type: T.unsafe(nil), filename: T.unsafe(nil)); end
# Returns the value of attribute content_type.
#
# source://http-form_data//lib/http/form_data/part.rb#18
def content_type; end
# Returns the value of attribute filename.
#
# source://http-form_data//lib/http/form_data/part.rb#18
def filename; end
end
# Common behaviour for objects defined by an IO object.
#
# source://http-form_data//lib/http/form_data/readable.rb#6
module HTTP::FormData::Readable
# Reads and returns part of IO content.
#
# @param length [Integer] Number of bytes to retrieve
# @param outbuf [String] String to be replaced with retrieved data
# @return [String, nil]
#
# source://http-form_data//lib/http/form_data/readable.rb#23
def read(length = T.unsafe(nil), outbuf = T.unsafe(nil)); end
# Rewinds the IO.
#
# source://http-form_data//lib/http/form_data/readable.rb#35
def rewind; end
# Returns IO size.
#
# @return [Integer]
#
# source://http-form_data//lib/http/form_data/readable.rb#30
def size; end
# Returns IO content.
#
# @return [String]
#
# source://http-form_data//lib/http/form_data/readable.rb#10
def to_s; end
end
# `application/x-www-form-urlencoded` form data.
#
# source://http-form_data//lib/http/form_data/urlencoded.rb#11
class HTTP::FormData::Urlencoded
include ::HTTP::FormData::Readable
# @param data [#to_h, Hash] form data key-value Hash
# @return [Urlencoded] a new instance of Urlencoded
#
# source://http-form_data//lib/http/form_data/urlencoded.rb#66
def initialize(data, encoder: T.unsafe(nil)); end
# Returns form data content size to be used for HTTP request
# `Content-Length` header.
#
# @return [Integer]
#
# source://http-form_data//lib/http/form_data/readable.rb#30
def content_length; end
# Returns MIME type to be used for HTTP request `Content-Type` header.
#
# @return [String]
#
# source://http-form_data//lib/http/form_data/urlencoded.rb#74
def content_type; end
class << self
# Returns form data encoder implementation.
# Default: `URI.encode_www_form`.
#
# @return [#call]
# @see .encoder=
#
# source://http-form_data//lib/http/form_data/urlencoded.rb#60
def encoder; end
# Set custom form data encoder implementation.
#
# @example
#
# module CustomFormDataEncoder
# UNESCAPED_CHARS = /[^a-z0-9\-\.\_\~]/i
#
# def self.escape(s)
# ::URI::DEFAULT_PARSER.escape(s.to_s, UNESCAPED_CHARS)
# end
#
# def self.call(data)
# parts = []
#
# data.each do |k, v|
# k = escape(k)
#
# if v.nil?
# parts << k
# elsif v.respond_to?(:to_ary)
# v.to_ary.each { |vv| parts << "#{k}=#{escape vv}" }
# else
# parts << "#{k}=#{escape v}"
# end
# end
#
# parts.join("&")
# end
# end
#
# HTTP::FormData::Urlencoded.encoder = CustomFormDataEncoder
# @param implementation [#call]
# @raise [ArgumentError] if implementation deos not responds to `#call`.
# @return [void]
#
# source://http-form_data//lib/http/form_data/urlencoded.rb#50
def encoder=(implementation); end
end
end
# Gem version.
#
# source://http-form_data//lib/http/form_data/version.rb#6
HTTP::FormData::VERSION = T.let(T.unsafe(nil), String)

275
sorbet/rbi/gems/llhttp-ffi@0.5.0.rbi generated Normal file
View File

@@ -0,0 +1,275 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `llhttp-ffi` gem.
# Please instead update this file by running `bin/tapioca gem llhttp-ffi`.
# source://llhttp-ffi//lib/llhttp.rb#6
module LLHttp
extend ::FFI::Library
def llhttp_errno_name(*_arg0); end
def llhttp_execute(*_arg0); end
def llhttp_finish(*_arg0); end
def llhttp_get_error_reason(*_arg0); end
def llhttp_reset(*_arg0); end
def llhttp_should_keep_alive(*_arg0); end
def rb_llhttp_content_length(*_arg0); end
def rb_llhttp_free(*_arg0); end
def rb_llhttp_http_major(*_arg0); end
def rb_llhttp_http_minor(*_arg0); end
def rb_llhttp_init(*_arg0); end
def rb_llhttp_method_name(*_arg0); end
def rb_llhttp_status_code(*_arg0); end
class << self
def llhttp_errno_name(*_arg0); end
def llhttp_execute(*_arg0); end
def llhttp_finish(*_arg0); end
def llhttp_get_error_reason(*_arg0); end
def llhttp_reset(*_arg0); end
def llhttp_should_keep_alive(*_arg0); end
def rb_llhttp_content_length(*_arg0); end
def rb_llhttp_free(*_arg0); end
def rb_llhttp_http_major(*_arg0); end
def rb_llhttp_http_minor(*_arg0); end
def rb_llhttp_init(*_arg0); end
def rb_llhttp_method_name(*_arg0); end
def rb_llhttp_status_code(*_arg0); end
# [public] LLHttp's current version.
#
# source://llhttp-ffi//lib/llhttp/version.rb#8
def version; end
end
end
# source://llhttp-ffi//lib/llhttp.rb#18
class LLHttp::Callbacks < ::FFI::Struct; end
# [public] Delegate for handling callbacks. Subclass this object and implement necessary methods.
#
# class Delegate < LLHttp::Delegate
# def on_message_begin
# ...
# end
#
# def on_url(url)
# ...
# end
#
# def on_status(status)
# ...
# end
#
# def on_header_field(field)
# ...
# end
#
# def on_header_value(value)
# ...
# end
#
# def on_headers_complete
# ...
# end
#
# def on_body(body)
# ...
# end
#
# def on_message_complete
# ...
# end
#
# def on_chunk_header
# ...
# end
#
# def on_chunk_complete
# ...
# end
#
# def on_url_complete
# ...
# end
#
# def on_status_complete
# ...
# end
#
# def on_header_field_complete
# ...
# end
#
# def on_header_value_complete
# ...
# end
# end
#
# source://llhttp-ffi//lib/llhttp/delegate.rb#64
class LLHttp::Delegate; end
# [public] LLHttp's standard error object.
#
# source://llhttp-ffi//lib/llhttp/error.rb#6
class LLHttp::Error < ::StandardError; end
# [public] Wraps an llhttp context for parsing http requests and responses.
#
# class Delegate < LLHttp::Delegate
# def on_message_begin
# ...
# end
#
# ...
# end
#
# parser = LLHttp::Parser.new(Delegate.new, type: :request)
# parser << "GET / HTTP/1.1\r\n\r\n"
# parser.finish
#
# ...
#
# Introspection
#
# * `LLHttp::Parser#content_length` returns the content length of the current request.
# * `LLHttp::Parser#method_name` returns the method name of the current response.
# * `LLHttp::Parser#status_code` returns the status code of the current response.
# * `LLHttp::Parser#http_major` returns the major http version of the current request/response.
# * `LLHttp::Parser#http_minor` returns the minor http version of the current request/response.
# * `LLHttp::Parser#keep_alive?` returns `true` if there might be more messages.
#
# Finishing
#
# Call `LLHttp::Parser#finish` when processing is complete for the current request or response.
#
# source://llhttp-ffi//lib/llhttp/parser.rb#33
class LLHttp::Parser
# @return [Parser] a new instance of Parser
#
# source://llhttp-ffi//lib/llhttp/parser.rb#60
def initialize(delegate, type: T.unsafe(nil)); end
# [public] Parse the given data.
#
# source://llhttp-ffi//lib/llhttp/parser.rb#78
def <<(data); end
# [public] Get the content length of the current request.
#
# source://llhttp-ffi//lib/llhttp/parser.rb#86
def content_length; end
# [public] Tells the parser we are finished.
#
# source://llhttp-ffi//lib/llhttp/parser.rb#122
def finish; end
# [public] Get the major http version of the current request/response.
#
# source://llhttp-ffi//lib/llhttp/parser.rb#104
def http_major; end
# [public] Get the minor http version of the current request/response.
#
# source://llhttp-ffi//lib/llhttp/parser.rb#110
def http_minor; end
# [public] Returns `true` if there might be more messages.
#
# @return [Boolean]
#
# source://llhttp-ffi//lib/llhttp/parser.rb#116
def keep_alive?; end
# [public] Get the method of the current response.
#
# source://llhttp-ffi//lib/llhttp/parser.rb#92
def method_name; end
# [public] Parse the given data.
#
# source://llhttp-ffi//lib/llhttp/parser.rb#78
def parse(data); end
# [public] Get ready to parse the next request/response.
#
# source://llhttp-ffi//lib/llhttp/parser.rb#128
def reset; end
# [public] Get the status code of the current response.
#
# source://llhttp-ffi//lib/llhttp/parser.rb#98
def status_code; end
# [public] The parser type; one of: `:both`, `:request`, or `:response`.
#
# source://llhttp-ffi//lib/llhttp/parser.rb#58
def type; end
private
# source://llhttp-ffi//lib/llhttp/parser.rb#156
def build_error(errno); end
# source://llhttp-ffi//lib/llhttp/parser.rb#149
def on_body(buffer, length); end
# source://llhttp-ffi//lib/llhttp/parser.rb#135
def on_chunk_complete; end
# source://llhttp-ffi//lib/llhttp/parser.rb#135
def on_chunk_header; end
# source://llhttp-ffi//lib/llhttp/parser.rb#149
def on_header_field(buffer, length); end
# source://llhttp-ffi//lib/llhttp/parser.rb#135
def on_header_field_complete; end
# source://llhttp-ffi//lib/llhttp/parser.rb#149
def on_header_value(buffer, length); end
# source://llhttp-ffi//lib/llhttp/parser.rb#135
def on_header_value_complete; end
# source://llhttp-ffi//lib/llhttp/parser.rb#135
def on_headers_complete; end
# source://llhttp-ffi//lib/llhttp/parser.rb#135
def on_message_begin; end
# source://llhttp-ffi//lib/llhttp/parser.rb#135
def on_message_complete; end
# source://llhttp-ffi//lib/llhttp/parser.rb#149
def on_status(buffer, length); end
# source://llhttp-ffi//lib/llhttp/parser.rb#135
def on_status_complete; end
# source://llhttp-ffi//lib/llhttp/parser.rb#149
def on_url(buffer, length); end
# source://llhttp-ffi//lib/llhttp/parser.rb#135
def on_url_complete; end
class << self
# source://llhttp-ffi//lib/llhttp/parser.rb#160
def free(pointer); end
end
end
# source://llhttp-ffi//lib/llhttp/parser.rb#36
LLHttp::Parser::CALLBACKS = T.let(T.unsafe(nil), Array)
# source://llhttp-ffi//lib/llhttp/parser.rb#48
LLHttp::Parser::CALLBACKS_WITH_DATA = T.let(T.unsafe(nil), Array)
# source://llhttp-ffi//lib/llhttp/parser.rb#34
LLHttp::Parser::LLHTTP_TYPES = T.let(T.unsafe(nil), Hash)
# source://llhttp-ffi//lib/llhttp/version.rb#4
LLHttp::VERSION = T.let(T.unsafe(nil), String)

750
sorbet/rbi/gems/ruby-bbcode@2.1.1.rbi generated Normal file
View File

@@ -0,0 +1,750 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `ruby-bbcode` gem.
# Please instead update this file by running `bin/tapioca gem ruby-bbcode`.
# Configuration holds RubyBBCode configuration
#
# source://ruby-bbcode//lib/ruby-bbcode/configuration.rb#2
class Configuration
# @return [Configuration] a new instance of Configuration
#
# source://ruby-bbcode//lib/ruby-bbcode/configuration.rb#9
def initialize; end
# Defines how to treat unknown tags
# * :exception throws and exception
# * :text converts it into a text
# * :ignore removes it from the output
#
# source://ruby-bbcode//lib/ruby-bbcode/configuration.rb#7
def ignore_unknown_tags; end
# source://ruby-bbcode//lib/ruby-bbcode/configuration.rb#13
def ignore_unknown_tags=(value); end
end
# RubyBBCode adds support for BBCode to Ruby.
# The BBCode is parsed by a parser before converted to HTML, allowing to convert nested BBCode tags in strings to their correct HTML equivalent.
# The used parser also checks whether the BBCode is valid and gives errors for incorrect BBCode texts.
#
# source://ruby-bbcode//lib/tags/tags.rb#1
module RubyBBCode
include ::RubyBBCode::Tags
class << self
# source://ruby-bbcode//lib/ruby-bbcode.rb#19
def configuration; end
# Sets the attribute configuration
#
# @param value the value to set the attribute configuration to.
#
# source://ruby-bbcode//lib/ruby-bbcode.rb#16
def configuration=(_arg0); end
# @yield [configuration]
#
# source://ruby-bbcode//lib/ruby-bbcode.rb#27
def configure; end
# source://ruby-bbcode//lib/ruby-bbcode.rb#23
def reset; end
# This method converts the given text (with BBCode tags) into a HTML representation
# The additional_tags parameter is used to add additional BBCode tags that should be accepted
# The method parameter determines whether the tags parameter needs to be used to blacklist (when set to :disable) or whitelist (when not set to :disable) the list of BBCode tags
# The method raises an exception when the text could not be parsed due to errors
#
# source://ruby-bbcode//lib/ruby-bbcode.rb#50
def to_bbcode(text, additional_tags = T.unsafe(nil), method = T.unsafe(nil), *tags); end
# This method converts the given text (with BBCode tags) into a HTML representation
# The escape_html parameter (default: true) escapes HTML tags that were present in the given text and therefore blocking (mallicious) HTML in the original text
# The additional_tags parameter is used to add additional BBCode tags that should be accepted
# The method parameter determines whether the tags parameter needs to be used to blacklist (when set to :disable) or whitelist (when not set to :disable) the list of BBCode tags
# The method raises an exception when the text could not be parsed due to errors
#
# source://ruby-bbcode//lib/ruby-bbcode.rb#36
def to_html(text, escape_html = T.unsafe(nil), additional_tags = T.unsafe(nil), method = T.unsafe(nil), *tags); end
# Returns true when valid, else returns array with error(s)
#
# source://ruby-bbcode//lib/ruby-bbcode.rb#57
def validity_check(text, additional_tags = T.unsafe(nil), method = T.unsafe(nil), *tags); end
protected
# This method provides the final set of bbcode tags, it merges the default tags with the given additional_tags
# and blacklists(method = :disable) or whitelists the list of tags with the given tags parameter.
#
# source://ruby-bbcode//lib/ruby-bbcode.rb#72
def determine_applicable_tags(additional_tags, method, *tags); end
# This method parses the given text (with BBCode tags) into a BBTree representation
# The escape_html parameter (default: true) escapes HTML tags that were present in the given text and therefore blocking (mallicious) HTML in the original text
# The additional_tags parameter is used to add additional BBCode tags that should be accepted
# The method parameter determines whether the tags parameter needs to be used to blacklist (when set to :disable) or whitelist (when not set to :disable) the list of BBCode tags
# The method raises an exception when the text could not be parsed due to errors
#
# source://ruby-bbcode//lib/ruby-bbcode.rb#91
def parse(text, escape_html = T.unsafe(nil), additional_tags = T.unsafe(nil), method = T.unsafe(nil), *tags); end
end
end
# Tree of nodes containing the parsed BBCode information and the plain texts
#
# As you parse a string of text, say:
# "[b]I'm bold and the next word is [i]ITALIC[/i][b]"
# ...you build up a tree of nodes (@bbtree). The above string is represented by 4 nodes when parsing has completed.
# * Node 1) An opening tag node representing "[b]"
# * Node 2) A text node representing "I'm bold and the next word is "
# * Node 3) An opening tag node representing "[i]"
# * Node 4) A text node representing "ITALIC"
#
# source://ruby-bbcode//lib/ruby-bbcode/bbtree.rb#12
class RubyBBCode::BBTree
# @return [BBTree] a new instance of BBTree
#
# source://ruby-bbcode//lib/ruby-bbcode/bbtree.rb#15
def initialize(hash = T.unsafe(nil)); end
# Create a new node and adds it to the current node as a child node
#
# source://ruby-bbcode//lib/ruby-bbcode/bbtree.rb#69
def build_up_new_tag(element); end
# Returns the value of attribute current_node.
#
# source://ruby-bbcode//lib/ruby-bbcode/bbtree.rb#13
def current_node; end
# Sets the attribute current_node
#
# @param value the value to set the attribute current_node to.
#
# source://ruby-bbcode//lib/ruby-bbcode/bbtree.rb#13
def current_node=(_arg0); end
# Advance to next level (the node we just added)
#
# source://ruby-bbcode//lib/ruby-bbcode/bbtree.rb#43
def escalate_bbtree(element); end
# just giving this method multiple names for semantical purposes
#
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/bbtree.rb#25
def expecting_a_closing_tag?; end
# source://ruby-bbcode//lib/ruby-bbcode/bbtree.rb#21
def nodes; end
# Return true if the parent tag only allows certain child tags
#
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/bbtree.rb#38
def parent_has_constraints_on_children?; end
# Returns the parent tag, if suitable/available
#
# source://ruby-bbcode//lib/ruby-bbcode/bbtree.rb#31
def parent_tag; end
# Step down the bbtree a notch because we've reached a closing tag
#
# source://ruby-bbcode//lib/ruby-bbcode/bbtree.rb#49
def retrogress_bbtree; end
# Returns the value of attribute tags_list.
#
# source://ruby-bbcode//lib/ruby-bbcode/bbtree.rb#13
def tags_list; end
# Sets the attribute tags_list
#
# @param value the value to set the attribute tags_list to.
#
# source://ruby-bbcode//lib/ruby-bbcode/bbtree.rb#13
def tags_list=(_arg0); end
# source://ruby-bbcode//lib/ruby-bbcode/bbtree.rb#77
def to_bbcode(tags = T.unsafe(nil)); end
# source://ruby-bbcode//lib/ruby-bbcode/bbtree.rb#73
def to_html(tags = T.unsafe(nil)); end
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/bbtree.rb#25
def within_open_tag?; end
end
# This class holds TagNode instances and helps converting them into code (using the provided template) when the time comes.
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_collection.rb#6
class RubyBBCode::TagCollection < ::Array
# Convert nodes to BBCode (with error information)
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_collection.rb#13
def to_bbcode(tags); end
# This method is vulnerable to stack-level-too-deep scenarios where >=1,200 tags are being parsed.
# But that scenario can be mitigated by splitting up the tags. bbtree = { :nodes => [900tags, 1000tags] }, the work
# for that bbtree can be split up into two passes, do the each node one at a time. I'm not coding that though, it's pointless, just a thought though
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_collection.rb#20
def to_code(tags, template, parent_node = T.unsafe(nil)); end
# Convert nodes to HTML
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_collection.rb#8
def to_html(tags); end
end
# TagInfo is basically what the regex scan get's converted into during the TagSifter#process_text method.
# This class was made mostly just to keep track of all of the confusing the logic conditions that are checked.
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#5
class RubyBBCode::TagInfo
# @return [TagInfo] a new instance of TagInfo
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#16
def initialize(tag_info, dictionary); end
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#20
def [](key); end
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#24
def []=(key, value); end
# Returns true if the tag element is allowed in the provided parent_tag
#
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#86
def allowed_in?(parent_tag); end
# Returns true if this tag has quick parameter support
#
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#91
def can_have_quick_param?; end
# Definition of this instance (when it represents a tag element)
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#29
def definition; end
# Returns true if this instance represents a closing tag element
#
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#71
def element_is_closing_tag?; end
# Returns true if this instance represents an opening tag element
#
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#66
def element_is_opening_tag?; end
# Returns true if this instance represents a tag element
#
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#56
def element_is_tag?; end
# Returns true if this instance represents a text element
#
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#61
def element_is_text?; end
# Converts this instance (from a tag) into a text element
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#49
def handle_tag_as_text; end
# Returns true if the tag param matches the regex pattern defined in tags.rb
#
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#96
def invalid_quick_param?; end
# Returns true if the tag that is represented by this instance is restricted on where it is allowed, i.e. if it is restricted by certain parent tags.
#
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#81
def only_allowed_in_parent_tags?; end
# Returns true if this tag element is included in the set of available tags
#
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#76
def tag_in_dictionary?; end
# Returns the text (when this instance represents a text element)
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#32
def text; end
# Returns the type of the cuvvrent tag/node, which is either :opening_tag, :closing_tag, or :text
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#42
def type; end
# Returns the whitespace that was available directly after the tag definition
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#37
def whitespace; end
protected
# Returns a default info structure used by all tags
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#103
def default_tag_info(tag_info); end
# Convert the result of the TagSifter#process_text regex into a more usable hash, that is used by the rest of the parser.
# tag_info should a result of the regex of TagSifter#process_text
# Returns the tag hash
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#114
def find_tag_info(tag_info, dictionary); end
end
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#10
RubyBBCode::TagInfo::CLOSING_MATCH = T.let(T.unsafe(nil), Integer)
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#9
RubyBBCode::TagInfo::COMPLETE_MATCH = T.let(T.unsafe(nil), Integer)
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#7
RubyBBCode::TagInfo::REGEX = T.let(T.unsafe(nil), Regexp)
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#6
RubyBBCode::TagInfo::REGEX_STRING = T.let(T.unsafe(nil), String)
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#11
RubyBBCode::TagInfo::TAG_MATCH = T.let(T.unsafe(nil), Integer)
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#12
RubyBBCode::TagInfo::TAG_PARAM_MATCH = T.let(T.unsafe(nil), Integer)
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#14
RubyBBCode::TagInfo::TEXT = T.let(T.unsafe(nil), Integer)
# source://ruby-bbcode//lib/ruby-bbcode/tag_info.rb#13
RubyBBCode::TagInfo::WHITESPACE_AFTER_TAG = T.let(T.unsafe(nil), Integer)
# A TagNode specifies either an opening tag element or a (plain) text elements
#
# TagInfo elements are essentially converted into these nodes which are
# later converted into html output in the bbtree_to_html method
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_node.rb#6
class RubyBBCode::TagNode
# ==== Attributes
#
# * +element+ - contains the information of TagInfo#tag_data.
# A text element has the form of
# { :is_tag=>false, :text=>"ITALIC" }
# and a tag element has the form of
# { :is_tag=>true, :tag=>:i, :nodes => [] }
# * +nodes+
#
# @return [TagNode] a new instance of TagNode
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_node.rb#18
def initialize(element); end
# source://ruby-bbcode//lib/ruby-bbcode/tag_node.rb#22
def [](key); end
# source://ruby-bbcode//lib/ruby-bbcode/tag_node.rb#26
def []=(key, value); end
# Returns true if the tag is allowed to have parameters
#
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_node.rb#36
def allow_params?; end
# Return an list containing the child nodes of this node.
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_node.rb#61
def children; end
# shows the tag definition for this TagNode as defined in tags.rb
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_node.rb#56
def definition; end
# Tag or text element that is stored in this node
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_node.rb#8
def element; end
# Tag or text element that is stored in this node
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_node.rb#8
def element=(_arg0); end
# Returns true if the node that child nodes
#
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_node.rb#46
def has_children?; end
# Returns true when the quick parameter was invalid (i.e. it did not match the required format)
#
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_node.rb#51
def invalid_quick_param?; end
# Returns true if the tag does not have any parameters set.
#
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_node.rb#41
def params_not_set?; end
# Returns :tag is the node is a tag node, and :text if the node is a text node
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_node.rb#31
def type; end
end
# TagSifter is in charge of building up the BBTree with nodes as it parses through the
# supplied text such as
# "[b]I'm bold and the next word is [i]ITALIC[/i][b]"
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#7
class RubyBBCode::TagSifter
# @return [TagSifter] a new instance of TagSifter
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#10
def initialize(text_to_parse, dictionary, escape_html = T.unsafe(nil)); end
# Returns the value of attribute bbtree.
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#8
def bbtree; end
# Returns the value of attribute errors.
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#8
def errors; end
# BBTree#process_text is responsible for parsing the actual BBCode text and converting it
# into a 'syntax tree' of nodes, each node represeting either a tag type or content for a tag
# once this tree is built, the to_html method can be invoked where the tree is finally
# converted into HTML syntax.
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#27
def process_text; end
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#19
def valid?; end
private
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#377
def add_tag_error(message, tag = T.unsafe(nil)); end
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#145
def create_text_element; end
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#354
def expecting_a_closing_tag?; end
# The media tag support multiple other tags, this method checks the tag url param to find actual tag type (to use)
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#132
def get_actual_tag; end
# Get 'between tag' for tag
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#161
def get_formatted_between; end
# Gets the params, and format them if needed...
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#151
def get_formatted_element_params; end
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#350
def has_no_text_node?; end
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#276
def last_tag_fit_in_this_tag?; end
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#168
def match_url_id(url, regex_matches); end
# Return the node that holds the last piece of text for the given node (self or child)
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#110
def node_last_text(node); end
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#371
def parent_has_constraints_on_children?; end
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#270
def parent_of_self_closing_tag?; end
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#367
def parent_tag; end
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#223
def self_closing_tag_reached_a_closer?; end
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#118
def set_multi_tag_to_actual_tag; end
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#321
def throw_child_requires_specific_parent_error; end
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#327
def throw_invalid_quick_param_error(tag); end
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#331
def throw_parent_prohibits_this_child_error; end
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#340
def throw_stack_level_will_be_too_deep_error; end
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#344
def to_sentence_bbcode_tags; end
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#99
def transfer_whitespace_to_closing_tag; end
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#362
def use_text_as_parameter?; end
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#241
def valid_closing_element?; end
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#227
def valid_constraints_on_child?; end
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#194
def valid_opening_tag?; end
# This validation is for text elements with between text
# that might be construed as a param.
# The validation code checks if the params match constraints
# imposed by the node/tag/parent.
#
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#287
def valid_param_supplied_as_text?; end
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#186
def valid_text_or_opening_element?; end
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#307
def validate_all_tags_closed_off; end
# Validates the element
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#180
def validate_element; end
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#317
def validate_stack_level_too_deep_potential; end
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/tag_sifter.rb#358
def within_open_tag?; end
end
# Provides the official/default BBCode tags as stated by http://www.bbcode.org/reference.php
#
# source://ruby-bbcode//lib/tags/tags.rb#3
module RubyBBCode::Tags
class << self
# source://ruby-bbcode//lib/tags/tags.rb#156
def tag_list; end
end
end
# source://ruby-bbcode//lib/ruby-bbcode/templates/html_template.rb#1
module RubyBBCode::Templates; end
# This class is designed to help us build up the (original) BBCode annotated with the error information.
# It starts out as a template such as...
# @opening_part = '[url=%param%]
# @closing_part = '[/url]'
# and then slowly turns into...
# @opening_part = '[url=http://www.blah.com"]cool beans'
# @closing_part = '[/url]'
#
# source://ruby-bbcode//lib/ruby-bbcode/templates/bbcode_errors_template.rb#11
class RubyBBCode::Templates::BBCodeErrorsTemplate
# @return [BBCodeErrorsTemplate] a new instance of BBCodeErrorsTemplate
#
# source://ruby-bbcode//lib/ruby-bbcode/templates/bbcode_errors_template.rb#14
def initialize(node); end
# source://ruby-bbcode//lib/ruby-bbcode/templates/bbcode_errors_template.rb#49
def closing_part; end
# source://ruby-bbcode//lib/ruby-bbcode/templates/bbcode_errors_template.rb#29
def inlay_between_text!; end
# source://ruby-bbcode//lib/ruby-bbcode/templates/bbcode_errors_template.rb#43
def inlay_closing_part!; end
# source://ruby-bbcode//lib/ruby-bbcode/templates/bbcode_errors_template.rb#34
def inlay_params!; end
# Returns the value of attribute opening_part.
#
# source://ruby-bbcode//lib/ruby-bbcode/templates/bbcode_errors_template.rb#12
def opening_part; end
# Sets the attribute opening_part
#
# @param value the value to set the attribute opening_part to.
#
# source://ruby-bbcode//lib/ruby-bbcode/templates/bbcode_errors_template.rb#12
def opening_part=(_arg0); end
# source://ruby-bbcode//lib/ruby-bbcode/templates/bbcode_errors_template.rb#45
def remove_unused_tokens!; end
private
# source://ruby-bbcode//lib/ruby-bbcode/templates/bbcode_errors_template.rb#55
def add_whitespace(whitespace); end
# source://ruby-bbcode//lib/ruby-bbcode/templates/bbcode_errors_template.rb#59
def get_between; end
class << self
# source://ruby-bbcode//lib/ruby-bbcode/templates/bbcode_errors_template.rb#22
def convert_text(node, _parent_node); end
# source://ruby-bbcode//lib/ruby-bbcode/templates/bbcode_errors_template.rb#65
def error_attribute(errors); end
end
end
# This class is designed to help us build up the HTML data. It starts out as a template such as...
# @opening_part = '<a href="%url%">%between%'
# @closing_part = '</a>'
# and then slowly turns into...
# @opening_part = '<a href="http://www.blah.com">cool beans'
# @closing_part = '</a>'
#
# source://ruby-bbcode//lib/ruby-bbcode/templates/html_template.rb#8
class RubyBBCode::Templates::HtmlTemplate
# @return [HtmlTemplate] a new instance of HtmlTemplate
#
# source://ruby-bbcode//lib/ruby-bbcode/templates/html_template.rb#11
def initialize(node); end
# Returns the value of attribute closing_part.
#
# source://ruby-bbcode//lib/ruby-bbcode/templates/html_template.rb#9
def closing_part; end
# Sets the attribute closing_part
#
# @param value the value to set the attribute closing_part to.
#
# source://ruby-bbcode//lib/ruby-bbcode/templates/html_template.rb#9
def closing_part=(_arg0); end
# source://ruby-bbcode//lib/ruby-bbcode/templates/html_template.rb#35
def inlay_between_text!; end
# source://ruby-bbcode//lib/ruby-bbcode/templates/html_template.rb#48
def inlay_closing_part!; end
# source://ruby-bbcode//lib/ruby-bbcode/templates/html_template.rb#39
def inlay_params!; end
# Returns the value of attribute opening_part.
#
# source://ruby-bbcode//lib/ruby-bbcode/templates/html_template.rb#9
def opening_part; end
# Sets the attribute opening_part
#
# @param value the value to set the attribute opening_part to.
#
# source://ruby-bbcode//lib/ruby-bbcode/templates/html_template.rb#9
def opening_part=(_arg0); end
# source://ruby-bbcode//lib/ruby-bbcode/templates/html_template.rb#52
def remove_unused_tokens!; end
private
# source://ruby-bbcode//lib/ruby-bbcode/templates/html_template.rb#64
def add_whitespace(key); end
# Return true if the between text is needed as param
#
# @return [Boolean]
#
# source://ruby-bbcode//lib/ruby-bbcode/templates/html_template.rb#73
def between_text_as_param?; end
# source://ruby-bbcode//lib/ruby-bbcode/templates/html_template.rb#77
def format_between; end
class << self
# source://ruby-bbcode//lib/ruby-bbcode/templates/html_template.rb#58
def convert_newlines(text); end
# Newlines are converted to html <br /> syntax before being returned.
#
# source://ruby-bbcode//lib/ruby-bbcode/templates/html_template.rb#19
def convert_text(node, parent_node); end
end
end

12
sorbet/rbi/gems/thruster@0.1.11.rbi generated Normal file
View File

@@ -0,0 +1,12 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `thruster` gem.
# Please instead update this file by running `bin/tapioca gem thruster`.
# source://thruster//lib/thruster.rb#1
module Thruster; end
# source://thruster//lib/thruster/version.rb#2
Thruster::VERSION = T.let(T.unsafe(nil), String)

View File

@@ -0,0 +1,39 @@
require "rails_helper"
RSpec.describe LogEntriesHelper, type: :helper do
describe "#render_msword_content" do
let(:log_entry) do
build(
:http_log_entry,
response:
build(
:blob_entry,
content_type: "application/msword",
contents:
File.binread(
Rails.root.join(
"test/fixtures/files/5447897_Thakur_trials_13.doc",
),
),
),
)
end
it "returns the converted HTML content" do
rendered = helper.render_msword_content(log_entry)
expect(rendered).not_to be_nil
# no abiword header
expect(rendered).not_to include("Abiword HTML Document")
# no bbcode tags
expect(rendered).not_to include("[i]")
expect(rendered).not_to include("[b]")
# remove line breaks
expect(rendered).not_to include("<br />")
# remove escaped html tags
expect(rendered).not_to include("&lt;br /&gt;")
expect(rendered).not_to include("&lt;")
expect(rendered).to include("The next morning")
end
end
end

Binary file not shown.