
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
= Bubble
Bubble is a library for creating HTML from basic Ruby data structures.
== Installation
Bubble is a gem.
gem install bubble
== Examples
Bubble can convert arrays and symbols into tags and hashes into attributes.
If you want to create simple tags:
b = Bubble.new([:h1, "Entitling!"])
b.to_html
# => "<h1>Entitling!</h1>"
Or if you want a tag with attributes:
link = Bubble.new([:a, {:href => "/images/free_cat.jpg"}, "Free Cat!"])
link.to_html
# => "<a href="/images/free_cat.jpg">Free Cat!</a>"
Empty tags:
sad_and_alone = Bubble.new([:p])
sad_and_alone.to_html
# => "<p />"
Or even nested tags:
blurb = Bubble.new([:marquee, {:style => 'font-weight: bold'}, [:font, "Arial",[:size, "smaller", [:b, "Made with DreamWeaver!"]]]])
blurb.to_html
# => "<marquee style="font-weight: bold"><font><Arial><size><smaller><b>Made with DreamWeaver!</b></smaller></size></Arial></font></marquee>"
Since Bubble objects are just repurposed Arrays and Hashes, you can perform all the same operations on them.
b = Bubble.new
b[0] = :p
b << "Parachute Pants!"
b += [{:class => "hammer#{Time.new.class.name.downcase}"}]
b.last.merge!(:action => 'Stop!')
b.to_html
# => "<p class="hammertime" action="Stop!">Parachute Pants!</p>"
== Purpose
While it's certainly conceivable that you could build an entire templating system around Bubble, it's intended to create and programatically maniuplate small snippets of HTML.
Ruby has an excellent library for working with arrays and hashes, and Bubble lets you work within the standard library instead of trying to wrangle raw HTML into a manipulable format.
== Contributing to Bubble
== Copyright
Copyright (c) 2011 Eric Budd. See LICENSE.txt for further details.
FAQs
Unknown package
We found that bubble 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
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.