monolens 0.5.2 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +51 -84
  3. data/lib/monolens/command/tester.rb +95 -0
  4. data/lib/monolens/command.rb +137 -18
  5. data/lib/monolens/error.rb +2 -0
  6. data/lib/monolens/file.rb +11 -0
  7. data/lib/monolens/jsonpath.rb +76 -0
  8. data/lib/monolens/lens/options.rb +26 -12
  9. data/lib/monolens/lens/signature/missing.rb +11 -0
  10. data/lib/monolens/lens/signature.rb +60 -0
  11. data/lib/monolens/lens.rb +25 -4
  12. data/lib/monolens/macros.rb +28 -0
  13. data/lib/monolens/namespace.rb +11 -0
  14. data/lib/monolens/registry.rb +77 -0
  15. data/lib/monolens/{array → stdlib/array}/compact.rb +2 -0
  16. data/lib/monolens/{array → stdlib/array}/join.rb +4 -0
  17. data/lib/monolens/{array → stdlib/array}/map.rb +13 -19
  18. data/lib/monolens/{array.rb → stdlib/array.rb} +8 -6
  19. data/lib/monolens/{check → stdlib/check}/not_empty.rb +4 -0
  20. data/lib/monolens/{check.rb → stdlib/check.rb} +4 -2
  21. data/lib/monolens/{coerce → stdlib/coerce}/date.rb +5 -0
  22. data/lib/monolens/{coerce → stdlib/coerce}/date_time.rb +6 -1
  23. data/lib/monolens/{coerce → stdlib/coerce}/integer.rb +4 -0
  24. data/lib/monolens/{coerce → stdlib/coerce}/string.rb +2 -0
  25. data/lib/monolens/{coerce.rb → stdlib/coerce.rb} +10 -8
  26. data/lib/monolens/{core → stdlib/core}/chain.rb +5 -3
  27. data/lib/monolens/{core → stdlib/core}/dig.rb +5 -0
  28. data/lib/monolens/stdlib/core/literal.rb +68 -0
  29. data/lib/monolens/{core → stdlib/core}/mapping.rb +15 -5
  30. data/lib/monolens/stdlib/core.rb +31 -0
  31. data/lib/monolens/stdlib/object/allbut.rb +22 -0
  32. data/lib/monolens/{object → stdlib/object}/extend.rb +10 -5
  33. data/lib/monolens/{object → stdlib/object}/keys.rb +4 -0
  34. data/lib/monolens/stdlib/object/merge.rb +56 -0
  35. data/lib/monolens/{object → stdlib/object}/rename.rb +5 -1
  36. data/lib/monolens/{object → stdlib/object}/select.rb +9 -0
  37. data/lib/monolens/{object → stdlib/object}/transform.rb +8 -3
  38. data/lib/monolens/{object → stdlib/object}/values.rb +9 -4
  39. data/lib/monolens/stdlib/object.rb +55 -0
  40. data/lib/monolens/{skip → stdlib/skip}/null.rb +2 -0
  41. data/lib/monolens/{skip.rb → stdlib/skip.rb} +4 -2
  42. data/lib/monolens/{str → stdlib/str}/downcase.rb +2 -0
  43. data/lib/monolens/{str → stdlib/str}/split.rb +5 -1
  44. data/lib/monolens/{str → stdlib/str}/strip.rb +2 -0
  45. data/lib/monolens/{str → stdlib/str}/upcase.rb +2 -0
  46. data/lib/monolens/{str.rb → stdlib/str.rb} +10 -8
  47. data/lib/monolens/stdlib.rb +7 -0
  48. data/lib/monolens/type/any.rb +39 -0
  49. data/lib/monolens/type/array.rb +27 -0
  50. data/lib/monolens/type/boolean.rb +17 -0
  51. data/lib/monolens/type/callback.rb +17 -0
  52. data/lib/monolens/type/coercible.rb +10 -0
  53. data/lib/monolens/type/diggable.rb +9 -0
  54. data/lib/monolens/type/emptyable.rb +9 -0
  55. data/lib/monolens/type/integer.rb +18 -0
  56. data/lib/monolens/type/lenses.rb +17 -0
  57. data/lib/monolens/type/map.rb +30 -0
  58. data/lib/monolens/type/object.rb +17 -0
  59. data/lib/monolens/type/responding.rb +25 -0
  60. data/lib/monolens/type/strategy.rb +56 -0
  61. data/lib/monolens/type/string.rb +18 -0
  62. data/lib/monolens/type/symbol.rb +20 -0
  63. data/lib/monolens/type.rb +33 -0
  64. data/lib/monolens/version.rb +2 -2
  65. data/lib/monolens.rb +22 -66
  66. data/spec/fixtures/macro.yml +13 -0
  67. data/spec/fixtures/recursive.yml +15 -0
  68. data/spec/monolens/command/literal.yml +2 -0
  69. data/spec/monolens/command/literal2.yml +2 -0
  70. data/spec/monolens/command/test-ko-complex.yml +15 -0
  71. data/spec/monolens/command/test-ko.lens.yml +13 -0
  72. data/spec/monolens/command/test-ok.lens.yml +9 -0
  73. data/spec/monolens/command/upcase.lens.yml +4 -0
  74. data/spec/monolens/lens/test_options.rb +2 -14
  75. data/spec/monolens/lens/test_signature.rb +38 -0
  76. data/spec/monolens/{array → stdlib/array}/test_compact.rb +8 -0
  77. data/spec/monolens/{array → stdlib/array}/test_join.rb +0 -0
  78. data/spec/monolens/{array → stdlib/array}/test_map.rb +15 -0
  79. data/spec/monolens/{check → stdlib/check}/test_not_empty.rb +0 -0
  80. data/spec/monolens/{coerce → stdlib/coerce}/test_date.rb +0 -0
  81. data/spec/monolens/{coerce → stdlib/coerce}/test_datetime.rb +1 -1
  82. data/spec/monolens/{coerce → stdlib/coerce}/test_integer.rb +0 -0
  83. data/spec/monolens/{coerce → stdlib/coerce}/test_string.rb +0 -0
  84. data/spec/monolens/{core → stdlib/core}/test_dig.rb +0 -0
  85. data/spec/monolens/stdlib/core/test_literal.rb +73 -0
  86. data/spec/monolens/{core → stdlib/core}/test_mapping.rb +37 -1
  87. data/spec/monolens/stdlib/object/test_allbut.rb +31 -0
  88. data/spec/monolens/{object → stdlib/object}/test_extend.rb +0 -0
  89. data/spec/monolens/{object → stdlib/object}/test_keys.rb +0 -0
  90. data/spec/monolens/stdlib/object/test_merge.rb +133 -0
  91. data/spec/monolens/{object → stdlib/object}/test_rename.rb +0 -0
  92. data/spec/monolens/{object → stdlib/object}/test_select.rb +0 -0
  93. data/spec/monolens/{object → stdlib/object}/test_transform.rb +0 -0
  94. data/spec/monolens/{object → stdlib/object}/test_values.rb +0 -0
  95. data/spec/monolens/{skip → stdlib/skip}/test_null.rb +0 -0
  96. data/spec/monolens/{str → stdlib/str}/test_downcase.rb +0 -0
  97. data/spec/monolens/{str → stdlib/str}/test_split.rb +0 -0
  98. data/spec/monolens/{str → stdlib/str}/test_strip.rb +0 -0
  99. data/spec/monolens/{str → stdlib/str}/test_upcase.rb +0 -0
  100. data/spec/monolens/test_command.rb +179 -1
  101. data/spec/monolens/test_error_traceability.rb +1 -1
  102. data/spec/monolens/test_jsonpath.rb +88 -0
  103. data/spec/monolens/test_lens.rb +1 -1
  104. data/spec/test_documentation.rb +52 -0
  105. data/spec/test_monolens.rb +20 -0
  106. data/tasks/test.rake +1 -1
  107. metadata +124 -55
  108. data/lib/monolens/core.rb +0 -23
  109. data/lib/monolens/object.rb +0 -41
@@ -1,41 +0,0 @@
1
- module Monolens
2
- module Object
3
- def extend(options)
4
- Extend.new(options)
5
- end
6
- module_function :extend
7
-
8
- def rename(parts)
9
- Rename.new(parts)
10
- end
11
- module_function :rename
12
-
13
- def transform(parts)
14
- Transform.new(parts)
15
- end
16
- module_function :transform
17
-
18
- def keys(lens)
19
- Keys.new(lens)
20
- end
21
- module_function :keys
22
-
23
- def values(lens)
24
- Values.new(lens)
25
- end
26
- module_function :values
27
-
28
- def select(lens)
29
- Select.new(lens)
30
- end
31
- module_function :select
32
-
33
- Monolens.define_namespace 'object', self
34
- end
35
- end
36
- require_relative 'object/rename'
37
- require_relative 'object/transform'
38
- require_relative 'object/keys'
39
- require_relative 'object/values'
40
- require_relative 'object/select'
41
- require_relative 'object/extend'