foraneus 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzE1YmEwZTI1OThmZDhkNjIxOGIyM2ZkYWQzMDJjMjYxYmUxYWU4NA==
4
+ YmI3NjNiNTIwZDUwZDVjMWFlM2U5Yjg0NmJjMDk3Yzc5MzEyZWE1Yg==
5
5
  data.tar.gz: !binary |-
6
- MjVjZjQwOTQ2MGE2OWQ5MWEzN2MyMDU3ZWVhZTEyZGVhOTkyMWJjNA==
6
+ OGNhNWM1OTQ5YTlmZjI2NjUwNWY2OWZlMzc3ZThkODdlYjFlMDcwYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjM1OTA2MDZmNjZjOWRkYmUyODVmZjRmMTc2N2U1NGY1MTc2OTI1NzM3MTJj
10
- YzlhNDY1OWVmYTc5YzEzMzE5NGY4ZDE2MDg5M2EyOGExMzE0YzM1OGQyYTU2
11
- N2JlYTA1MTY1YTFkMzQwNTY2YjJiY2I3OWM2ODJhYjQ2MGI1NmY=
9
+ MzU5NjRmMGIwODlhNmQzMTBkYWFjMmMyMzJjM2NhYjQxOGY4MWQxOTc1NDk3
10
+ ZWU0NGNmODJhODNlODk4ZDBhMmI4NzkxNGRmZWQ4YmRhZTIzMmQwYTc0MDY0
11
+ YTQwYjYzNGE5NGFiMDcyOWQ1MGVhYWQ3M2Q1MmUyM2I3M2UwYmU=
12
12
  data.tar.gz: !binary |-
13
- YzEzM2VkYWQ5Y2NlOTU5MTMwY2U4MDliOTg2ZTkzNmMzZTBhMGY2NDgwZTVi
14
- OWJhYjlhOGFjNzZiZDdkMzdiMDcwNGQ2NjVhZGE4OWIxNTc2ZGYxMGFjYjJi
15
- OTQ1NWI4YzIxYmNlMDgwYmFkYjRiNmM1OTQ0MzQ1OGJiOGIwYzE=
13
+ ZWQzN2ZlYmQ1MmQyMjlmZThjYzIxYjMyODMzNjczZjdmNGM3MzM1MTE3Mzll
14
+ ZmZjNzE3OTA2MzQ5ZTE1OWFhNzliNzRiOTk1ZGYzNGFkNTZmYTA4YWY4OTBh
15
+ OTIyM2ZjZTJjOTg4NGIyM2JiZjViOWI5YjIxNzNkMWRkYTFhMGM=
data/lib/foraneus.rb CHANGED
@@ -3,6 +3,7 @@ require_relative 'foraneus/converters/date'
3
3
  require_relative 'foraneus/converters/decimal'
4
4
  require_relative 'foraneus/converters/float'
5
5
  require_relative 'foraneus/converters/integer'
6
+ require_relative 'foraneus/converters/noop'
6
7
  require_relative 'foraneus/converters/string'
7
8
  require_relative 'foraneus/errors'
8
9
 
@@ -46,6 +47,11 @@ class Foraneus
46
47
  field(name, converter)
47
48
  end
48
49
 
50
+ def self.noop(name)
51
+ converter = Foraneus::Converters::Noop.new
52
+ field(name, converter)
53
+ end
54
+
49
55
  def self.string(name)
50
56
  converter = Foraneus::Converters::String.new
51
57
  field(name, converter)
@@ -0,0 +1,15 @@
1
+ class Foraneus
2
+ module Converters
3
+
4
+ class Noop
5
+ def parse(o)
6
+ o
7
+ end
8
+
9
+ def raw(o)
10
+ o
11
+ end
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe Foraneus::Converters::Noop do
4
+
5
+ describe '#parse' do
6
+ it 'returns the given object' do
7
+ o = Object.new
8
+
9
+ subject.parse(o).should be(o)
10
+ end
11
+ end
12
+
13
+ describe '#raw' do
14
+ it 'returns the given object' do
15
+ o = Object.new
16
+
17
+ subject.raw(o).should be(o)
18
+ end
19
+ end
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foraneus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gianfranco Zas
@@ -35,6 +35,7 @@ files:
35
35
  - lib/foraneus/converters/boolean.rb
36
36
  - lib/foraneus/converters/string.rb
37
37
  - lib/foraneus/converters/float.rb
38
+ - lib/foraneus/converters/noop.rb
38
39
  - lib/foraneus/converters/decimal.rb
39
40
  - lib/foraneus/converters/date.rb
40
41
  - lib/foraneus/converters/integer.rb
@@ -42,6 +43,7 @@ files:
42
43
  - COPYING.LESSER
43
44
  - README.md
44
45
  - spec/lib/foraneus_spec.rb
46
+ - spec/lib/foraneus/converters/noop_converter_spec.rb
45
47
  - spec/lib/foraneus/converters/decimal_converter_spec.rb
46
48
  - spec/lib/foraneus/converters/date_converter_spec.rb
47
49
  - spec/lib/foraneus/converters/integer_converter_spec.rb
@@ -75,6 +77,7 @@ specification_version: 4
75
77
  summary: Validates and transform external data.
76
78
  test_files:
77
79
  - spec/lib/foraneus_spec.rb
80
+ - spec/lib/foraneus/converters/noop_converter_spec.rb
78
81
  - spec/lib/foraneus/converters/decimal_converter_spec.rb
79
82
  - spec/lib/foraneus/converters/date_converter_spec.rb
80
83
  - spec/lib/foraneus/converters/integer_converter_spec.rb