ruby.rs — tailwindcss Source File
Architecture documentation for ruby.rs, a rust file in the tailwindcss codebase. 8 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 7c0d4cec_4adf_c5af_98ca_2b77fd576491["ruby.rs"] 06c7e220_fd8f_0caf_b9d5_1bb1af2eddad["super::Ruby"] 7c0d4cec_4adf_c5af_98ca_2b77fd576491 --> 06c7e220_fd8f_0caf_b9d5_1bb1af2eddad 96a36755_a007_15e1_ec6c_526c02d24b9b["crate::cursor"] 7c0d4cec_4adf_c5af_98ca_2b77fd576491 --> 96a36755_a007_15e1_ec6c_526c02d24b9b 9bfe5545_ae1a_8808_5f91_cbe10f598d06["crate::extractor::bracket_stack"] 7c0d4cec_4adf_c5af_98ca_2b77fd576491 --> 9bfe5545_ae1a_8808_5f91_cbe10f598d06 ed5b6564_5e78_f7bf_cdc6_b0150d9116c1["crate::extractor::pre_processors::pre_processor::PreProcessor"] 7c0d4cec_4adf_c5af_98ca_2b77fd576491 --> ed5b6564_5e78_f7bf_cdc6_b0150d9116c1 31c3994f_a10b_9230_4730_a596a4e7c40d["crate::scanner::pre_process_input"] 7c0d4cec_4adf_c5af_98ca_2b77fd576491 --> 31c3994f_a10b_9230_4730_a596a4e7c40d f799c3c8_4426_1389_085e_d75f31945865["bstr::ByteVec"] 7c0d4cec_4adf_c5af_98ca_2b77fd576491 --> f799c3c8_4426_1389_085e_d75f31945865 2d9b4cae_93a6_ad2d_32b6_1beee2f47881["regex::"] 7c0d4cec_4adf_c5af_98ca_2b77fd576491 --> 2d9b4cae_93a6_ad2d_32b6_1beee2f47881 6d15903a_0cf5_e00c_800c_2bb2605c4081["std::sync"] 7c0d4cec_4adf_c5af_98ca_2b77fd576491 --> 6d15903a_0cf5_e00c_800c_2bb2605c4081 style 7c0d4cec_4adf_c5af_98ca_2b77fd576491 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// See: - https://docs.ruby-lang.org/en/3.4/syntax/literals_rdoc.html#label-Percent+Literals
// - https://docs.ruby-lang.org/en/3.4/syntax/literals_rdoc.html#label-25w+and+-25W-3A+String-Array+Literals
use crate::cursor;
use crate::extractor::bracket_stack;
use crate::extractor::pre_processors::pre_processor::PreProcessor;
use crate::scanner::pre_process_input;
use bstr::ByteVec;
use regex::{Regex, RegexBuilder};
use std::sync;
static TEMPLATE_START_REGEX: sync::LazyLock<Regex> = sync::LazyLock::new(|| {
RegexBuilder::new(r#"\s*([a-z0-9_-]+)_template\s*<<[-~]?([A-Z]+)$"#)
.multi_line(true)
.build()
.unwrap()
});
static TEMPLATE_END_REGEX: sync::LazyLock<Regex> = sync::LazyLock::new(|| {
RegexBuilder::new(r#"^\s*([A-Z]+)"#)
.multi_line(true)
.build()
.unwrap()
});
#[derive(Debug, Default)]
pub struct Ruby;
impl PreProcessor for Ruby {
fn process(&self, content: &[u8]) -> Vec<u8> {
let len = content.len();
let mut result = content.to_vec();
let mut cursor = cursor::Cursor::new(content);
let mut bracket_stack = bracket_stack::BracketStack::default();
// Extract embedded template languages
// https://viewcomponent.org/guide/templates.html#interpolations
let content_as_str = std::str::from_utf8(content).unwrap();
let starts = TEMPLATE_START_REGEX
.captures_iter(content_as_str)
.collect::<Vec<_>>();
let ends = TEMPLATE_END_REGEX
.captures_iter(content_as_str)
.collect::<Vec<_>>();
for start in starts.iter() {
// The language for this block
let lang = start.get(1).unwrap().as_str();
// The HEREDOC delimiter
let delimiter_start = start.get(2).unwrap().as_str();
// Where the "body" starts for the HEREDOC block
let body_start = start.get(0).unwrap().end();
// Look through all of the ends to find a matching language
for end in ends.iter() {
// 1. This must appear after the start
let body_end = end.get(0).unwrap().start();
if body_end < body_start {
// ... (371 more lines)
Domain
Subdomains
Functions
Dependencies
- bstr::ByteVec
- crate::cursor
- crate::extractor::bracket_stack
- crate::extractor::pre_processors::pre_processor::PreProcessor
- crate::scanner::pre_process_input
- regex::
- std::sync
- super::Ruby
Source
Frequently Asked Questions
What does ruby.rs do?
ruby.rs is a source file in the tailwindcss codebase, written in rust. It belongs to the Oxide domain, PreProcessors subdomain.
What functions are defined in ruby.rs?
ruby.rs defines 7 function(s): RegexBuilder, process, test_embedded_slim_extraction, test_ruby_extraction, test_ruby_pre_processor, test_skip_comments, test_strict_locals.
What does ruby.rs depend on?
ruby.rs imports 8 module(s): bstr::ByteVec, crate::cursor, crate::extractor::bracket_stack, crate::extractor::pre_processors::pre_processor::PreProcessor, crate::scanner::pre_process_input, regex::, std::sync, super::Ruby.
Where is ruby.rs in the architecture?
ruby.rs is located at crates/oxide/src/extractor/pre_processors/ruby.rs (domain: Oxide, subdomain: PreProcessors, directory: crates/oxide/src/extractor/pre_processors).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free