Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

inox_converter

Package Overview
Dependencies
Maintainers
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inox_converter

  • 1.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
6
Created
Source

InoxConverter

Coverage

Gem Version

Build Status

Hi! Welcome to Inox Converter official page! Our gem is created to work like a 'swiss army knife' for Ruby developers, bringing a easy and reliable way to convert some formats and units that commonly appear during the developing process. You can: convert area, currency(real time), length, mass, volume and format time and date. You want to use one unit that doesn't exist in our gem? You can add that unit too! And more... As a framework you can extend our gem and create your own convertions type.

Installation

Add this line to your application's Gemfile:

  gem 'inox_converter'

And then execute:

  bundle install

Or install it yourself as:

  gem install inox_converter

Usage

To make a conversion:

  • valueToConvert: the value you want to convert
  • firstUnit: actual unit -> string
  • secondUnit: the unit you want to convert to -> string
Exemplos
InoxConverter.convertCurrency(valueToConvert, firstUnit, secondUnit)
InoxConverter.convertLenght(valueToConvert, firstUnit, secondUnit)
InoxConverter.convertVolume(valueToConvert, firstUnit, secondUnit)
InoxConverter.convertArea(valueToConvert, firstUnit, secondUnit)
InoxConverter.convertMass(valueToConvert, firstUnit, secondUnit)
InoxConverter.convertTime(valueToConvert, firstUnit, secondUnit)
InoxConverter.convertTimeFormat(timeToFormat, desiredFormat)
InoxConverter.convertDateFormat(dateToFormat, desiredFormat)
InoxConverter.convertCurrency(10, "USD", "BRL")
InoxConverter.convertLenght(10, 'meter', 'kilometer')
InoxConverter.convertDateFormat(Date.today, "DMY")

To add a unit:

- newUnit: name of the new unit to be added -> string - newRate: reason between new unit and base unit
InoxConverter.addLenghtUnit(newUnit, newRate)
InoxConverter.addVolumeUnit(newUnit, newRate)
InoxConverter.addAreaUnit(newUnit, newRate)
InoxConverter.addMassUnit(newUnit, newRate)
InoxConverter.addTimeUnit(newUnit, newRate)
InoxConverter.addDateFormat(newFormat, newRate)
InoxConverter.addTimeFormat(newFormat, newRate)

If you want to add a lenght unit called MyUnit that is ten times greater than the base unit of lenght (meter), you should to this:

InoxConverter.addLenghtUnit('MyUnit', 10)

Base units:

  • Area: squared meter
  • Currency: dollar
  • Length: meter
  • Mass: gram
  • Time: second
  • Volume: liter

Usage

You can see all types and units to convert in this link: List of Units

We also have a full user manual in portuguese: Manual de Usuário

Manual in Englise: coming soon.

Contributing

First you must choose an issue or request for us to create a new one

Then clone or fork our Repository

Time to Code!

Run

bundle install
bash build.sh

That's it inox_converter is install in your machine and ready use.

Do your contribution.

Don't forget to make your test's!

We use Rspec

Run your tests with:
rspec

License

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

FAQs

Package last updated on 26 Jun 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc