You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+55-14Lines changed: 55 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
# OrderTransformer
2
2
3
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/data_transformer`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+
Note: This gem is in maintenance mode and not actively updated.
4
4
5
-
TODO: Delete this and the text above, and describe your gem
5
+
The order transformer transforms data from an external format to the desired target format.
6
6
7
7
## Installation
8
8
@@ -12,17 +12,64 @@ Add this line to your application's Gemfile:
12
12
gem 'order_transformer'
13
13
```
14
14
15
-
And then execute:
15
+
And then run `bundle install`.
16
16
17
-
$ bundle install
17
+
## Usage
18
18
19
-
Or install it yourself as:
19
+
The gem allows you to define data transformations via a DSL like so:
20
20
21
-
$ gem install data_transformer
21
+
```ruby
22
+
OrderTransformer::DSL.define :some_shop, "v1.0"do
23
+
definition do
24
+
order as::hashdo
25
+
# The core of the transformation process is implemented by using the `transform` method. This maps the input "OrderNumber" field to the output "order_number" field.
26
+
transform "OrderNumber", to:"_order_number"
27
+
28
+
# By default, values of input data are not required to be set. To
0 commit comments