What is Scorched?
Scorched is a Ruby web framework designed for developers seeking a generic, unopinionated, and lightweight solution for building web applications. It offers a powerful set of constructs for processing HTTP requests, allowing the creation of websites and applications across various scales. The framework emphasizes simplicity and transparency, avoiding hidden complexities or "magic" in its design.
Built as an evolutionary enhancement of Sinatra, Scorched provides familiar DSL-based syntax while adding more power and focus. It leverages Ruby classes for controllers, enabling developers to define helpers and functionality as standard instance methods, which enhances predictability and supports inheritance. The framework supports sub-controllers to arbitrary depths, facilitating hierarchical website structures and inheritance of attributes like configuration and filters.
Features
- Controllers as Classes: Allows defining helpers and functionality as standard instance methods with inheritance support
- Sub-Controllers: Supports hierarchical controllers to arbitrary depths for inheriting configuration, filters, and conditions
- Route Priorities: Assigns arbitrary numbers to order routes, with higher numbers indicating higher priority
- Multi-Method Routes: Handles multiple HTTP methods like GET and POST within a single route definition
- Named Wildcards: Uses double colons for wildcards that span forward-slashes in URL patterns
- Conditions: Evaluates procs in controller context before routing, offering flexibility for request handling
- Lightweight Design: Avoids overlapping functionality with Rack, keeping the framework raw and transparent
- DSL-Based Syntax: Provides familiar routing helpers similar to Sinatra for ease of use
Use Cases
- Building small to large-scale websites with Ruby
- Developing RESTful APIs with hierarchical routing
- Creating web applications that require flexible request processing
- Implementing security measures through controller inheritance
- Designing interchangeable content types for web interfaces
FAQs
-
What are the system requirements for using Scorched?
Scorched requires Ruby 2.0 or above, specifically versions including changeset 39919 to avoid segmentation faults. -
How does Scorched compare to other Ruby frameworks like Sinatra?
Scorched is an evolutionary enhancement of Sinatra, offering more power, focus, and less clutter while maintaining a similar DSL-based syntax. -
Can Scorched handle hierarchical website structures?
Yes, Scorched supports sub-controllers to arbitrary depths, allowing inheritance of configuration, filters, and conditions for hierarchical designs. -
Does Scorched integrate with Rack?
Yes, Scorched makes no attempt to hide Rack and requires familiarity with it, avoiding overlapping functionality to stay lightweight.