Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

vladyio/greek_abc

Repository files navigation

GreekABC

Gem Version RSpec status

Greek alphabet as a gem, nothing extra.

Well documented, covered with tests and RBS.

Installation

Legacy v0.4.4

Ruby >= 2.7 is recommended

Add this line to your application's Gemfile:

gem 'greek_abc', '~> 2.0.0'

And then execute:

$ bundle

Or install it yourself as:

$ gem install greek_abc

Usage

🔤 Get an array of all letters

GreekABC::Alphabet.new.letters

🔎 Look up a letter by attributes

GreekABC::Alphabet.new.find_letter(name: 'lambda')
GreekABC::Alphabet.new.find_letter(position: 5)

🫳🏻 Easily reach for the letter attributes

l = GreekABC::Alphabet.new.find_letter(name: 'lambda')

puts [l.name, l.position, l.lower]

#️⃣ Get the ABC as a hash:

abc = GreekABC::Alphabet.new
puts abc.to_h # => {"Alpha"=>{:position=>1, :lower=>"α", :upper=>"Α" ...

🖨️ Print print print!

puts GreekABC::Alphabet.new.letters

# ...
# Letter #16 'Pi', lowercase 'π', uppercase 'Π'
# Letter #17 'Rho', lowercase 'ρ', uppercase 'Ρ'
# Letter #18 'Sigma', lowercase 'σ / ς', uppercase 'Σ'
# ...

✨Alternative✨ lowercase Sigma support

GreekABC::Alphabet.new.find_letter(name: :sigma)

# <GreekABC::Letter:0x00000001078e4c90
#  @lower="σ",
#  @lower_alt="ς", <== cool, right?
#  @name="Sigma",
#  @position=18,
#  @upper="Σ">

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/vladyio/greek_abc.

License

The gem is available as open source under the terms of the MIT License.

Changelog

See CHANGELOG.