AkatoshBot
AkatoshBot provides a mechanism for translating Earthly Time
objects into
their corresponding Tamrielic name. It only emits the calendar half of the name,
as we know nothing about Tamrielic clocks at this time.
Installation
Add this line to your application's Gemfile:
gem 'akatosh_bot'
And then execute:
$ bundle
Or install it yourself as:
$ gem install akatosh_bot
Usage
In your project, make an instance of Time
and call tamriel
on it. tamriel
supports two options in an implicit hash, year
and era
.
The year
option has multiple allowed possibilities.
- string: the given string is printed verbatim as the year
- integer: the year is printed as
"4E#{year}"
- Boolean: prints or suppresses the calculated year
The era
option alters the era prefix of the year. It currently defaults to 4.
If year
is a string, era
is ignored.
t = Time.now
puts t.tamriel
puts t.tamriel year: true
puts t.tamriel year: true, era: 3
t = Time.new 2011, 11, 11
puts t.tamriel #=> Fredas, 11th of Sun's Dusk
puts t.tamriel year: true #=> Fredas, 11th of Sun's Dusk, 4E201
puts t.tamriel year: "Dawn Era" #=> Fredas, 11th of Sun's Dusk, Dawn Era
puts t.tamriel era: 3, year: 327 #=> Fredas, 11th of Sun's Dusk, 3E327
To test the only dicey part, open a REPL and then run this snippet:
(1..31).each do |d|
# Taken from akatosh_bot.rb:20
puts "#{d}#{%w[th st nd rd][d / 10 != 1 && d % 10 < 4 ? d % 10 : 0]}"
end
It should emit the proper ordinals of all 31 days, with 'st' for 1, 21, and 31; 'nd' for 2 and 22; 'rd' for 3 and 23, and 'th' for everything else.
Development
After checking out the repo, run bin/setup
to install dependencies. 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/myrrlyn/akatosh_bot.
License
The gem is available as open source under the terms of the MIT License.