faceter 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/faceter.gemspec +1 -1
  4. data/lib/faceter/nodes/change_prefix.rb +1 -1
  5. data/lib/faceter/nodes/create.rb +1 -1
  6. data/lib/faceter/nodes/exclude.rb +1 -1
  7. data/lib/faceter/nodes/field.rb +1 -1
  8. data/lib/faceter/nodes/fold.rb +1 -1
  9. data/lib/faceter/nodes/group.rb +1 -1
  10. data/lib/faceter/nodes/list.rb +1 -1
  11. data/lib/faceter/nodes/rename.rb +1 -1
  12. data/lib/faceter/nodes/stringify_keys.rb +1 -1
  13. data/lib/faceter/nodes/symbolize_keys.rb +1 -1
  14. data/lib/faceter/nodes/unfold.rb +1 -1
  15. data/lib/faceter/nodes/ungroup.rb +1 -1
  16. data/lib/faceter/nodes/unwrap.rb +1 -1
  17. data/lib/faceter/nodes/wrap.rb +1 -1
  18. data/lib/faceter/rules/append_nested.rb +1 -1
  19. data/lib/faceter/rules/merge_branches.rb +2 -2
  20. data/lib/faceter/rules/merge_excludes.rb +1 -1
  21. data/lib/faceter/rules/merge_renames.rb +1 -1
  22. data/lib/faceter/rules/order_fields.rb +1 -1
  23. data/lib/faceter/rules/prepend_nested.rb +1 -1
  24. data/lib/faceter/version.rb +1 -1
  25. data/spec/integration/commands/add_prefix_spec.rb +2 -2
  26. data/spec/integration/commands/exclude_spec.rb +5 -5
  27. data/spec/integration/commands/fold_spec.rb +2 -2
  28. data/spec/integration/commands/group_spec.rb +5 -5
  29. data/spec/integration/commands/remove_prefix_spec.rb +6 -6
  30. data/spec/integration/commands/rename_spec.rb +2 -2
  31. data/spec/integration/commands/stringify_keys_spec.rb +8 -8
  32. data/spec/integration/commands/symbolize_keys_spec.rb +4 -4
  33. data/spec/integration/commands/unfold_spec.rb +2 -2
  34. data/spec/integration/commands/ungroup_spec.rb +5 -5
  35. data/spec/integration/commands/unwrap_spec.rb +4 -4
  36. data/spec/integration/commands/wrap_spec.rb +4 -4
  37. data/spec/unit/functions/add_prefix_spec.rb +1 -1
  38. data/spec/unit/functions/claster_spec.rb +1 -1
  39. data/spec/unit/functions/drop_prefix_spec.rb +3 -3
  40. data/spec/unit/functions/group_spec.rb +6 -6
  41. data/spec/unit/functions/ungroup_spec.rb +1 -1
  42. data/spec/unit/functions/wrap_spec.rb +6 -6
  43. data/spec/unit/nodes/add_prefix_spec.rb +7 -7
  44. data/spec/unit/nodes/create_spec.rb +6 -6
  45. data/spec/unit/nodes/exclude_spec.rb +1 -1
  46. data/spec/unit/nodes/field_spec.rb +3 -3
  47. data/spec/unit/nodes/fold_spec.rb +2 -2
  48. data/spec/unit/nodes/group_spec.rb +10 -10
  49. data/spec/unit/nodes/list_spec.rb +2 -2
  50. data/spec/unit/nodes/remove_prefix_spec.rb +7 -7
  51. data/spec/unit/nodes/rename_spec.rb +1 -1
  52. data/spec/unit/nodes/unfold_spec.rb +2 -2
  53. data/spec/unit/nodes/ungroup_spec.rb +1 -1
  54. data/spec/unit/nodes/unwrap_spec.rb +4 -4
  55. data/spec/unit/nodes/wrap_spec.rb +2 -2
  56. data/spec/unit/rules/append_nested_spec.rb +5 -5
  57. data/spec/unit/rules/merge_branches_spec.rb +11 -11
  58. data/spec/unit/rules/merge_excludes_spec.rb +2 -2
  59. data/spec/unit/rules/merge_renames_spec.rb +7 -7
  60. data/spec/unit/rules/prepend_nested_spec.rb +5 -5
  61. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e6f8053205fcafa7fa89140ea545b1c176840c3
4
- data.tar.gz: 903dc64fc54cc8ee2231af4a0e2665fd65784b23
3
+ metadata.gz: d2cf266f7b49a3638d144a76f51ddad60c64af90
4
+ data.tar.gz: e717c2f6d00f63ad0aaaf0acef9c07388cb96766
5
5
  SHA512:
6
- metadata.gz: 03947b2e5af98ca277fc1cbcca5c427858bdf21123f3346031ef3011a4fe84ba19c27642e162418fe10fea997e8f162981e187bc9be3a5ae3af1e97e5ea19b01
7
- data.tar.gz: 9f1766a2a30985818a2c77fe94d00baad66ca200a83aab13a78daafe8e23cc58f204acbe40f6d6f19503949c79c46277dd94ee32b0677f1b84d450ce7396f972
6
+ metadata.gz: 501a24e65b48f6364e9efbf946638bba3c6b9d48a7ecc6c87ada53f1e66718d259203357252a36d9f120fb3eebf541d8ca40589ce7f378225c2683385ca05da5
7
+ data.tar.gz: 2e92c28f7149f0da7435483da77854a45ddf4b71e303448bc33987b2a2b9d4fd7c1d05607d4e844967c507413dded1c49ca6265ec19067cd85ebd806ea654be5
@@ -1,3 +1,12 @@
1
+ ## version 0.1.0 2015-09-18
2
+
3
+ ### Change
4
+
5
+ * Switched to 'abstract_mapper' API v0.1.0 (nepalez)
6
+ with reference to #2 (martinciu)
7
+
8
+ [Compare v0.0.2...v0.1.0](https://github.com/nepalez/faceter/compare/v0.0.2...v0.1.0)
9
+
1
10
  ## version 0.0.2 2015-09-18
2
11
 
3
12
  ### Bugs Fixed
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
18
18
 
19
19
  gem.required_ruby_version = ">= 2.1"
20
20
 
21
- gem.add_runtime_dependency "abstract_mapper", "~> 0.0.2"
21
+ gem.add_runtime_dependency "abstract_mapper", "~> 0.1.0"
22
22
  gem.add_runtime_dependency "selector", "~> 0.0"
23
23
 
24
24
  gem.add_development_dependency "hexx-rspec", "~> 0.4"
@@ -11,7 +11,7 @@ module Faceter
11
11
  #
12
12
  # @api private
13
13
  #
14
- class ChangePrefix < AbstractMapper::Node
14
+ class ChangePrefix < AbstractMapper::AST::Node
15
15
 
16
16
  attribute :prefix
17
17
  attribute :separator, default: "_"
@@ -6,7 +6,7 @@ module Faceter
6
6
  #
7
7
  # @api private
8
8
  #
9
- class Create < AbstractMapper::Node
9
+ class Create < AbstractMapper::AST::Node
10
10
 
11
11
  attribute :name
12
12
  attribute :keys
@@ -6,7 +6,7 @@ module Faceter
6
6
  #
7
7
  # @api private
8
8
  #
9
- class Exclude < AbstractMapper::Node
9
+ class Exclude < AbstractMapper::AST::Node
10
10
 
11
11
  attribute :selector
12
12
 
@@ -6,7 +6,7 @@ module Faceter
6
6
  #
7
7
  # @api private
8
8
  #
9
- class Field < AbstractMapper::Branch
9
+ class Field < AbstractMapper::AST::Branch
10
10
 
11
11
  attribute :key
12
12
 
@@ -6,7 +6,7 @@ module Faceter
6
6
  #
7
7
  # @api private
8
8
  #
9
- class Fold < AbstractMapper::Node
9
+ class Fold < AbstractMapper::AST::Node
10
10
 
11
11
  attribute :key
12
12
 
@@ -6,7 +6,7 @@ module Faceter
6
6
  #
7
7
  # @api private
8
8
  #
9
- class Group < AbstractMapper::Node
9
+ class Group < AbstractMapper::AST::Node
10
10
 
11
11
  attribute :key
12
12
  attribute :selector
@@ -8,7 +8,7 @@ module Faceter
8
8
  #
9
9
  # @api private
10
10
  #
11
- class List < AbstractMapper::Branch
11
+ class List < AbstractMapper::AST::Branch
12
12
 
13
13
  # Builds a transproc function for the node from its child nodes
14
14
  #
@@ -6,7 +6,7 @@ module Faceter
6
6
  #
7
7
  # @api private
8
8
  #
9
- class Rename < AbstractMapper::Node
9
+ class Rename < AbstractMapper::AST::Node
10
10
 
11
11
  attribute :keys, default: {}
12
12
 
@@ -6,7 +6,7 @@ module Faceter
6
6
  #
7
7
  # @api private
8
8
  #
9
- class StringifyKeys < AbstractMapper::Node
9
+ class StringifyKeys < AbstractMapper::AST::Node
10
10
 
11
11
  attribute :nested, default: true
12
12
 
@@ -6,7 +6,7 @@ module Faceter
6
6
  #
7
7
  # @api private
8
8
  #
9
- class SymbolizeKeys < AbstractMapper::Node
9
+ class SymbolizeKeys < AbstractMapper::AST::Node
10
10
 
11
11
  attribute :nested, default: true
12
12
 
@@ -6,7 +6,7 @@ module Faceter
6
6
  #
7
7
  # @api private
8
8
  #
9
- class Unfold < AbstractMapper::Node
9
+ class Unfold < AbstractMapper::AST::Node
10
10
 
11
11
  attribute :key
12
12
 
@@ -6,7 +6,7 @@ module Faceter
6
6
  #
7
7
  # @api private
8
8
  #
9
- class Ungroup < AbstractMapper::Node
9
+ class Ungroup < AbstractMapper::AST::Node
10
10
 
11
11
  attribute :key
12
12
  attribute :selector
@@ -6,7 +6,7 @@ module Faceter
6
6
  #
7
7
  # @api private
8
8
  #
9
- class Unwrap < AbstractMapper::Node
9
+ class Unwrap < AbstractMapper::AST::Node
10
10
 
11
11
  attribute :key
12
12
  attribute :selector
@@ -6,7 +6,7 @@ module Faceter
6
6
  #
7
7
  # @api private
8
8
  #
9
- class Wrap < AbstractMapper::Node
9
+ class Wrap < AbstractMapper::AST::Node
10
10
 
11
11
  attribute :key
12
12
  attribute :selector
@@ -9,7 +9,7 @@ module Faceter
9
9
  #
10
10
  # @api private
11
11
  #
12
- class AppendNested < AbstractMapper::PairRule
12
+ class AppendNested < AbstractMapper::Rules::Pair
13
13
 
14
14
  # @private
15
15
  def optimize?
@@ -10,11 +10,11 @@ module Faceter
10
10
  #
11
11
  # @api private
12
12
  #
13
- class MergeBranches < AbstractMapper::PairRule
13
+ class MergeBranches < AbstractMapper::Rules::Pair
14
14
 
15
15
  # @private
16
16
  def optimize?
17
- left.is_a?(AbstractMapper::Branch) &&
17
+ left.is_a?(AbstractMapper::AST::Branch) &&
18
18
  right.class.equal?(__left_node__) &&
19
19
  right.attributes.eql?(__left_attributes__)
20
20
  end
@@ -10,7 +10,7 @@ module Faceter
10
10
  #
11
11
  # @api private
12
12
  #
13
- class MergeExcludes < AbstractMapper::PairRule
13
+ class MergeExcludes < AbstractMapper::Rules::Pair
14
14
 
15
15
  # @private
16
16
  def optimize?
@@ -8,7 +8,7 @@ module Faceter
8
8
  #
9
9
  # @api private
10
10
  #
11
- class MergeRenames < AbstractMapper::PairRule
11
+ class MergeRenames < AbstractMapper::Rules::Pair
12
12
 
13
13
  # @private
14
14
  def optimize?
@@ -6,7 +6,7 @@ module Faceter
6
6
 
7
7
  # Orders consecutive fields by their names to allow merging them later
8
8
  #
9
- class OrderFields < AbstractMapper::Rule
9
+ class OrderFields < AbstractMapper::Rules::Base
10
10
 
11
11
  # @private
12
12
  def optimize?
@@ -32,7 +32,7 @@ module Faceter
32
32
  #
33
33
  # @api private
34
34
  #
35
- class PrependNested < AbstractMapper::PairRule
35
+ class PrependNested < AbstractMapper::Rules::Pair
36
36
 
37
37
  # @private
38
38
  def optimize?
@@ -6,6 +6,6 @@ module Faceter
6
6
 
7
7
  # The semantic version of the module.
8
8
  # @see http://semver.org/ Semantic versioning 2.0
9
- VERSION = "0.0.2".freeze
9
+ VERSION = "0.1.0".freeze
10
10
 
11
11
  end # module Faceter
@@ -9,7 +9,7 @@ describe "add_prefix" do
9
9
  {
10
10
  "id" => 1, "name" => "joe",
11
11
  "contacts" => [{ "email" => "joe@example.com" }]
12
- }
12
+ }
13
13
  ]
14
14
  end
15
15
 
@@ -18,7 +18,7 @@ describe "add_prefix" do
18
18
  {
19
19
  "id" => 1, "user-name" => "joe",
20
20
  "user-contacts" => [{ "user-email" => "joe@example.com" }]
21
- }
21
+ }
22
22
  ]
23
23
  end
24
24
 
@@ -11,23 +11,23 @@ describe "exclude" do
11
11
  id: 1,
12
12
  name: "joe",
13
13
  contacts: [{ email: "joe@doe.com", type: "job" }]
14
- },
14
+ },
15
15
  role: "admin"
16
- },
16
+ },
17
17
  {
18
18
  user: {
19
19
  id: 2,
20
20
  name: "jane",
21
21
  contacts: [{ email: "jane@doe.com", type: "job" }]
22
- },
22
+ },
23
23
  role: "admin"
24
- }
24
+ }
25
25
  ]
26
26
  end
27
27
 
28
28
  let(:output) do
29
29
  [
30
- { user: { name: "joe", contacts: [{ email: "joe@doe.com" }] } },
30
+ { user: { name: "joe", contacts: [{ email: "joe@doe.com" }] } },
31
31
  { user: { name: "jane", contacts: [{ email: "jane@doe.com" }] } }
32
32
  ]
33
33
  end
@@ -16,11 +16,11 @@ describe "fold" do
16
16
  {
17
17
  name: "Joe",
18
18
  emails: [{ address: "joe@doe.com" }, { address: "joe@doe.org" }]
19
- },
19
+ },
20
20
  {
21
21
  name: "Jane",
22
22
  emails: [{ address: "jane@doe.com" }]
23
- }
23
+ }
24
24
  ]
25
25
  end
26
26
 
@@ -11,13 +11,13 @@ describe "group" do
11
11
  role: "admin",
12
12
  type: "job",
13
13
  contacts: [{ email: "joe@doe.com" }, { email: "joe@doe.org" }]
14
- },
14
+ },
15
15
  {
16
16
  name: "Ian",
17
17
  role: "admin",
18
18
  type: "job",
19
19
  contacts: [{ email: "ian@doe.com" }, { email: "ian@doe.org" }]
20
- }
20
+ }
21
21
  ]
22
22
  end
23
23
 
@@ -32,16 +32,16 @@ describe "group" do
32
32
  { email: "joe@doe.com", type: "job" },
33
33
  { email: "joe@doe.org", type: "job" }
34
34
  ]
35
- },
35
+ },
36
36
  {
37
37
  name: "Ian",
38
38
  contacts: [
39
39
  { email: "ian@doe.com", type: "job" },
40
40
  { email: "ian@doe.org", type: "job" }
41
41
  ]
42
- }
42
+ }
43
43
  ]
44
- }
44
+ }
45
45
  ]
46
46
  end
47
47
 
@@ -15,12 +15,12 @@ describe "remove_prefix" do
15
15
  {
16
16
  :"contact.address" => "joe@doe.com",
17
17
  "contact.type" => "job"
18
- }
18
+ }
19
19
  ],
20
20
  user_skype: "joe"
21
- }
21
+ }
22
22
  ]
23
- }
23
+ }
24
24
  ]
25
25
  end
26
26
 
@@ -35,12 +35,12 @@ describe "remove_prefix" do
35
35
  {
36
36
  address: "joe@doe.com",
37
37
  "type" => "job"
38
- }
38
+ }
39
39
  ],
40
40
  user_skype: "joe"
41
- }
41
+ }
42
42
  ]
43
- }
43
+ }
44
44
  ]
45
45
  end
46
46
 
@@ -6,14 +6,14 @@ describe "rename" do
6
6
 
7
7
  let(:input) do
8
8
  [
9
- { user: { name: "joe", contacts: [{ email: "joe@doe.com" }] } },
9
+ { user: { name: "joe", contacts: [{ email: "joe@doe.com" }] } },
10
10
  { user: { name: "jane", contacts: [{ email: "jane@doe.com" }] } }
11
11
  ]
12
12
  end
13
13
 
14
14
  let(:output) do
15
15
  [
16
- { "user" => { "name" => "joe", emails: [{ address: "joe@doe.com" }] } },
16
+ { "user" => { "name" => "joe", emails: [{ address: "joe@doe.com" }] } },
17
17
  { "user" => { "name" => "jane", emails: [{ address: "jane@doe.com" }] } }
18
18
  ]
19
19
  end
@@ -11,17 +11,17 @@ describe "stringify_keys" do
11
11
  user: {
12
12
  name: "joe",
13
13
  "emails" => [{ address: "joe@doe.com" }]
14
- },
14
+ },
15
15
  roles: [{ name: "admin" }]
16
- },
16
+ },
17
17
  {
18
18
  id: 2,
19
19
  user: {
20
20
  name: "jane",
21
21
  "emails" => [{ address: "jane@doe.com" }]
22
- },
22
+ },
23
23
  roles: [{ name: "admin" }]
24
- }
24
+ }
25
25
  ]
26
26
  end
27
27
 
@@ -32,17 +32,17 @@ describe "stringify_keys" do
32
32
  "user" => {
33
33
  "name" => "joe",
34
34
  "emails" => [{ "address" => "joe@doe.com" }]
35
- },
35
+ },
36
36
  "roles" => [{ name: "admin" }]
37
- },
37
+ },
38
38
  {
39
39
  "id" => 2,
40
40
  "user" => {
41
41
  "name" => "jane",
42
42
  "emails" => [{ "address" => "jane@doe.com" }]
43
- },
43
+ },
44
44
  "roles" => [{ name: "admin" }]
45
- }
45
+ }
46
46
  ]
47
47
  end
48
48
 
@@ -11,9 +11,9 @@ describe "symbolize_keys" do
11
11
  "user" => {
12
12
  "name" => "joe",
13
13
  emails: [{ "address" => "joe@doe.com" }]
14
- },
14
+ },
15
15
  "roles" => [{ "name" => "admin" }]
16
- }
16
+ }
17
17
  ]
18
18
  end
19
19
 
@@ -24,9 +24,9 @@ describe "symbolize_keys" do
24
24
  user: {
25
25
  name: "joe",
26
26
  emails: [{ address: "joe@doe.com" }]
27
- },
27
+ },
28
28
  roles: [{ "name" => "admin" }]
29
- }
29
+ }
30
30
  ]
31
31
  end
32
32