Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Money on My Mind - A pure Ruby gem for currency exchange.
__ __ __ __
| \/ | | \/ |
| \ / | ___ _ __ ___ _ _ ___ _ __ | \ / |_ _
| |\/| |/ _ \| '_ \ / _ \ | | | / _ \| '_ \ | |\/| | | | |
| | | | (_) | | | | __/ |_| | | (_) | | | | | | | | |_| |
|_| |_|\___/|_| |_|\___|\__, | \___/|_| |_| |_| |_|\__, |
__/ | __/ |
|___/ |___/
__ __ _ _
| \/ (_) | |
| \ / |_ _ __ __| |
| |\/| | | '_ \ / _` |
| | | | | | | | (_| |
|_| |_|_|_| |_|\__,_|
Keep calm bro. We'll calculate rate for you.
Ensure that either Memcached or Redis is installed on the machines/servers for exchange rate store
Add this line to your application's Gemfile:
gem 'momm'
And then execute:
$ bundle
Or install it yourself as:
$ gem install momm
After the gem is installed, momm provide you a command line tool. The storage engine by default is Memcached. Make sure that its running in the background. Also make sure that you got the dalli
gem installed
$ momm rate GBP CNY # Exchange rate by default is today.
$ momm exchange 100 GBP USD 2014-3-1 # Exchange rate at 2013-3-1
$ momm update # Fetch feeds from remote and update the storage
require 'dalli' # Make sure that dalli is required before momm
require 'momm'
Momm.exchange_rate 'GBP', 'USD' # By default Today
Momm.exchange_rate 'GBP', 'USD', date: Date.today
Momm.exchange 100, 'GBP', 'USD'
Momm.exchange 100, 'GBP', 'USD', date: Date.today
Momm.exchange_from_gbp_to_usd 100
Momm.update! # Fetching the feeds from remote. Only do that if you find any abnormal.
Momm.store :redis_store # Use redis as the default storage. Ensure 'redis' & 'redis-namespace is installed'
Momm.fed :ECB # Use ECB as the default currency exchange feeds
# Favoured way of configuration
Momm.setup do
store :redis_store, host: "127.0.0.1", namespace: "green_tea"
end
Web service is provided by Momm on Rails, however you need to install sinatra simply by adding gem 'sinatra'
into your Gemfile. Then require momm/web
module and edit your routes like:
# routes.rb
require 'dalli'
require 'momm/web'
Myapp::Application.routes.draw do
mount Momm::Web => '/momm'
end
If you want to switch to Redis, you can create an initialzer like:
# Gemfile
gem 'redis'
gem 'redis-namespace'
# momm_initialzer.rb
Momm.setup do
store :redis_store, host: "127.0.0.1", namespace: "green_tea"
end
After boot your rails application, you can visit '/momm'. A mounted app has already been in place.
After mounted the engine to Rails, without configuration, you can simply copy & paste the widget code to your HTML files.
echo '//= require money-on-my-mind' >> app/assets/javascripts/application.js
to insert home made js to your assets.
No stylesheets included, so it might look sucks a bit. Feel free to add your own css.
Widget of SLIM template looks like below. Currenly only safe for work for Rails templates.
.momm data-url="/momm/query"
p
| Date:
input.mom-ele.momm-date type="text" /
p
| How much:
input.mom-ele.momm-money type="text" value="1" /
p
| From:
select.mom-ele.momm-from
= options_for_select(Momm.currencies)
p
| To:
select.mom-ele.momm-to
= options_for_select(Momm.currencies)
p
| Exchange:
span.momm-exchange
# config.ru
require 'dalli' # again make sure that dalli is required beforehand!!!
require 'momm/web'
run Momm::Web
Just rack it up!
$ rake rspec
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that momm 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.