inox_converter 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +63 -27
- data/lib/inox_converter/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c78b57f5d1239a76763dfc9b654dac1e69eebbd
|
4
|
+
data.tar.gz: d3136ea6c36c84cb008d716f2ba0a38ac4bdcff7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e174ead0e44e5db780ea6bae44ee8de01652ac7ee0ba1d5e34a15417c8df658af0c43ecc0063c5938b98e006a2f3498767fb395080c6bf37f4b045171059e7ec
|
7
|
+
data.tar.gz: 95ddcd4281f39fdb116a0c2be279792a470412ae69eb438ab14fc881482a8cbdd3337b97fe6ab01af68e815a3a515de50be8ff7c9daecd68e9b343a977bbede6
|
data/README.md
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
# InoxConverter
|
2
2
|
|
3
|
-
|
3
|
+
![Coverage](https://img.shields.io/badge/coverage-97.67%25-brightgreen.svg)
|
4
|
+
|
5
|
+
![Gem Version](https://img.shields.io/badge/gem%20version-1.0.0-brightgreen.svg)
|
4
6
|
|
5
|
-
[![
|
7
|
+
[![Build Status](https://travis-ci.org/vinisilvacar/InoxConverter.svg?branch=master)](https://travis-ci.org/vinisilvacar/InoxConverter)
|
6
8
|
|
7
9
|
Hi! Welcome to Inox Converter official page!
|
8
10
|
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.
|
9
|
-
You can: convert area, currency, length, mass, volume and format time and date.
|
11
|
+
You can: convert area, currency(real time), length, mass, volume and format time and date.
|
10
12
|
You want to use one unit that doesn't exist in our gem? You can add that unit too!
|
11
13
|
And more... As a framework you can extend our gem and create your own convertions type.
|
12
14
|
|
@@ -15,39 +17,49 @@ And more... As a framework you can extend our gem and create your own convertion
|
|
15
17
|
Add this line to your application's Gemfile:
|
16
18
|
|
17
19
|
```ruby
|
18
|
-
gem 'inox_converter'
|
20
|
+
gem 'inox_converter'
|
19
21
|
```
|
20
22
|
|
21
23
|
And then execute:
|
22
24
|
|
23
|
-
|
25
|
+
```script
|
26
|
+
bundle install
|
27
|
+
```
|
24
28
|
|
25
29
|
Or install it yourself as:
|
26
30
|
|
27
|
-
|
31
|
+
```script
|
32
|
+
gem install inox_converter
|
33
|
+
```
|
28
34
|
|
29
35
|
## Usage
|
30
36
|
|
31
37
|
To make a conversion:
|
32
38
|
|
33
|
-
<i>
|
34
39
|
- valueToConvert: the value you want to convert
|
35
40
|
- firstUnit: actual unit -> string
|
36
41
|
- secondUnit: the unit you want to convert to -> string
|
37
|
-
</i>
|
38
42
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
43
|
+
#### Exemplos
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
InoxConverter.convertCurrency(valueToConvert, firstUnit, secondUnit)
|
47
|
+
InoxConverter.convertLenght(valueToConvert, firstUnit, secondUnit)
|
48
|
+
InoxConverter.convertVolume(valueToConvert, firstUnit, secondUnit)
|
49
|
+
InoxConverter.convertArea(valueToConvert, firstUnit, secondUnit)
|
50
|
+
InoxConverter.convertMass(valueToConvert, firstUnit, secondUnit)
|
51
|
+
InoxConverter.convertTime(valueToConvert, firstUnit, secondUnit)
|
52
|
+
InoxConverter.convertTimeFormat(timeToFormat, desiredFormat)
|
53
|
+
InoxConverter.convertDateFormat(dateToFormat, desiredFormat)
|
54
|
+
```
|
45
55
|
|
46
|
-
Example:
|
47
56
|
```ruby
|
57
|
+
InoxConverter.convertCurrency(10, "USD", "BRL")
|
48
58
|
InoxConverter.convertLenght(10, 'meter', 'kilometer')
|
59
|
+
InoxConverter.convertDateFormat(Date.today, "DMY")
|
49
60
|
```
|
50
61
|
|
62
|
+
|
51
63
|
To add a unit:
|
52
64
|
|
53
65
|
<i>
|
@@ -55,20 +67,22 @@ To add a unit:
|
|
55
67
|
- newRate: reason between new unit and base unit
|
56
68
|
</i>
|
57
69
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
70
|
+
```ruby
|
71
|
+
InoxConverter.addLenghtUnit(newUnit, newRate)
|
72
|
+
InoxConverter.addVolumeUnit(newUnit, newRate)
|
73
|
+
InoxConverter.addAreaUnit(newUnit, newRate)
|
74
|
+
InoxConverter.addMassUnit(newUnit, newRate)
|
75
|
+
InoxConverter.addTimeUnit(newUnit, newRate)
|
76
|
+
InoxConverter.addDateFormat(newFormat, newRate)
|
77
|
+
InoxConverter.addTimeFormat(newFormat, newRate)
|
78
|
+
```
|
65
79
|
|
66
80
|
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:
|
81
|
+
|
67
82
|
```ruby
|
68
83
|
InoxConverter.addLenghtUnit('MyUnit', 10)
|
69
84
|
```
|
70
85
|
|
71
|
-
|
72
86
|
### Base units:
|
73
87
|
|
74
88
|
- Area: squared meter
|
@@ -78,16 +92,38 @@ InoxConverter.addLenghtUnit('MyUnit', 10)
|
|
78
92
|
- Time: second
|
79
93
|
- Volume: liter
|
80
94
|
|
81
|
-
##
|
95
|
+
## Usage
|
96
|
+
You can see all types and units to convert in this link:
|
97
|
+
[List of Units](https://github.com/vinisilvacar/InoxConverter/wiki/Tipos-de-Convers%C3%A3o)
|
82
98
|
|
83
|
-
|
99
|
+
We also have a full user manual in portuguese: [Manual de Usuário](https://github.com/vinisilvacar/InoxConverter/wiki/Manual-de-Usu%C3%A1rio)
|
84
100
|
|
85
|
-
|
101
|
+
Manual in Englise: coming soon.
|
86
102
|
|
87
103
|
## Contributing
|
104
|
+
First you must choose an issue or request for us to create a new one
|
105
|
+
|
106
|
+
Then clone or fork our Repository
|
107
|
+
|
108
|
+
Time to Code!
|
88
109
|
|
89
|
-
|
110
|
+
Run
|
90
111
|
|
112
|
+
```script
|
113
|
+
bundle install
|
114
|
+
bash build.sh
|
115
|
+
```
|
116
|
+
|
117
|
+
That's it inox_converter is install in your machine and ready use.
|
118
|
+
|
119
|
+
Do your contribution.
|
120
|
+
<p style="color: red;">Don't forget to make your test's! </P>
|
121
|
+
<p> We use Rspec </P>
|
122
|
+
Run your tests with:
|
123
|
+
|
124
|
+
```script
|
125
|
+
rspec
|
126
|
+
```
|
91
127
|
|
92
128
|
## License
|
93
129
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inox_converter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lucas Andrade
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: exe
|
15
15
|
cert_chain: []
|
16
|
-
date: 2017-06-
|
16
|
+
date: 2017-06-26 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: bundler
|
@@ -47,16 +47,16 @@ dependencies:
|
|
47
47
|
name: activesupport
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
requirements:
|
50
|
-
- - "
|
50
|
+
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
52
|
+
version: 4.2.0
|
53
53
|
type: :runtime
|
54
54
|
prerelease: false
|
55
55
|
version_requirements: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - "
|
57
|
+
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version:
|
59
|
+
version: 4.2.0
|
60
60
|
description: Convert currency, temperature, lenght...
|
61
61
|
email:
|
62
62
|
- lucasandradeunb@gmail.com
|