https://github.com/moi-solutions/galadriel
Gem for handling parameter arrays.
https://github.com/moi-solutions/galadriel
array arrays gem hash parse parser rails ruby
Last synced: about 1 year ago
JSON representation
Gem for handling parameter arrays.
- Host: GitHub
- URL: https://github.com/moi-solutions/galadriel
- Owner: moi-solutions
- License: mit
- Created: 2017-08-17T20:09:57.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-01-16T00:27:52.000Z (over 8 years ago)
- Last Synced: 2025-04-09T04:11:57.650Z (about 1 year ago)
- Topics: array, arrays, gem, hash, parse, parser, rails, ruby
- Language: Ruby
- Homepage: https://rubygems.org/gems/galadriel
- Size: 3.91 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# galadriel
Gem for handling parameter arrays.
```ruby
hash_array = Galadriel.parse(params[:my_params])
```
## From
```
{
"id": [
"231",
"609"
],
"item_short_name": [
"Glifosato",
"Diesel"
],
"profit_center_code": [
"",
""
],
"name": [
"Glifosan 10L",
"Disel 1L"
],
"container": [
"10.0 L",
"1.0 L"
],
"onhand_quantity": [
"124.1000 und",
"489.5000 und"
],
"reserved_quantity": [
"0.0000 und",
"0.0000 und"
],
"diff_quantity": [
"114.1000 und",
"479.5000 und"
],
"new_quantity": [
"10.0000 und",
"10.0000 und"
],
"new_unit_cost": [
"350.0000",
"23.0000"
],
"reason": [
"4",
"2"
],
"reason_type": [
"Reducción",
"Reducción"
]
}
```
## To
```
[
{
"id": "231",
"item_short_name": "Glifosato",
"profit_center_code": "",
"name": "Glifosan 10L",
"container": "10.0 L",
"onhand_quantity": "124.1000 und",
"reserved_quantity": "0.0000 und",
"diff_quantity": "114.1000 und",
"new_quantity": "10.0000 und",
"new_unit_cost": "350.0000",
"reason": "4",
"reason_type": "Reducción"
},
{
"id": "609",
"item_short_name": "Diesel",
"profit_center_code": "",
"name": "Disel 1L",
"container": "1.0 L",
"onhand_quantity": "489.5000 und",
"reserved_quantity": "0.0000 und",
"diff_quantity": "479.5000 und",
"new_quantity": "10.0000 und",
"new_unit_cost": "23.0000",
"reason": "2",
"reason_type": "Reducción"
}
]
```