Ribsum - Lightweight and Simple Lorem Ipsum Text Generator
- Categories:
- tutorial
Hi! I’ve created Ribsum Ruby gem. Ribsum is a lightweight Ruby gem that allows you to easily generate lorem ipsum text.
The reason is why create this gem is so many unmaintained Lorem Ipsum generator. Beside that I want to create simpler Lorem Ipsum generator.
Ribsum is a useful tool for anyone working on a design project or who needs placeholder text for a website or application.
To use Ribsum, simply install the gem and require it in your Ruby code:
gem install ribsum
Once you have Ribsum installed, you can use it to generate lorem ipsum text in a few different ways. You can call the Ribsum methods directly, like this:
# Paragraph
Ribsum.paragraphs # default 1 paragraph
# => Lorem ipsum dolor sit amet...laborum
Ribsum.paragraphs(2)
# => Lorem ipsum dolor sit amet...laborum.
# => Lorem ipsum dolor sit amet...laborum.
# Sentences
Ribsum.sentences # default 1 sentence
# => Lorem ipsum dolor sit amet...aliqua
Ribsum.sentences(2)
# => Lorem ipsum dolor sit amet...consequat
# Words
Ribsum.words # default 1 word
# => Lorem
Ribsum.words(2)
# => Lorem ipsum
# Characters
Ribsum.chars # default 1 character
# => L
Ribsum.chars(2)
# => Lo
Alternatively, you can include Ribsum in your own class, like this:
class MyClass
include Ribsum
...
end
my_class = new MyClass
my_class.paragraphs
# => Lorem ipsum dolor sit amet...laborum
my_class.sentences
# => Lorem ipsum dolor sit amet...aliqua
my_class.words
# => Lorem
my_class.chars
# => L
Ribsum is a simple and easy-to-use gem that can save you time and effort when working on design projects or creating placeholder text. It is a valuable tool for any Ruby developer.
- Tags:
- #ruby