
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Primrose is a Ruby library designed for building component-based web applications. It provides a collection of modules and classes to manage the state, routing, rendering, and event handling for a modern web application. Primrose offers the following key features:
Primrose::Store
Primrose::Rose
subclassesPrimrose::Router
Primrose::Observable
You can install the library by adding it to your Gemfile
:
gem 'primrose', '~> 0.0.1'
Then run bundle install
to install the dependency.
store = Primrose::Store.new({ counter: 0 })
store.dispatch({
type: 'INCREMENT',
updates: {
counter: -> (current_value) { current_value + 1 }
}
})
router = Primrose::Router.new
router.route('/home') { puts "You're at home" }
router.route('/about') { puts "About page" }
router.navigate('/home') # Outputs "You're at home"
Creating a custom component is easy:
class MyComponent < Primrose::Rose
def render
"Hello, world!"
end
end
You can attach event handlers to your components:
component = MyComponent.new
component.on(:click) { puts 'Component clicked!' }
component.trigger(:click) # Outputs "Component clicked!"
Below are some example templates to showcase how components can be structured.
Button Component:
<button onclick="<%= @action %>">
<%= @label %>
</button>
Text Field Component:
<input type="text" placeholder="<%= @placeholder %>">
Checkbox Component:
<div class="checkbox">
<input type="checkbox">
<label><%= @label %></label>
</div>
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE.md file for details.
For more detailed usage and full API documentation, please refer to the inline code comments and accompanying documentation.
Feel free to raise an issue for any bugs, feature requests, or questions.
Note: This documentation assumes that you are familiar with Ruby and ERB (Embedded Ruby).
FAQs
Unknown package
We found that primrose demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.