monolens 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0de27df8fbe83531b35a1b3c4b92d94669108ef10f17df849d9127a07698ad2
4
- data.tar.gz: abf82eebdd9511578b0cd73524430335f9b9c8ecb60fe74598eec3e6c0d5f5e5
3
+ metadata.gz: 937b78e577006ce716022cb0ae10fe2dfd21f174be62e67c2f9eefe161f07151
4
+ data.tar.gz: 90493bf5855603ea1181a5c86a9ba313937954cadb659d95dbca6386b5ba085b
5
5
  SHA512:
6
- metadata.gz: 3909ab4f03d872d0083884ddea46e3d2546caeef268c83e1145204789050c89e34cd219161a672e07a5b34727c40f21a23be501b85ea7aaed2dd9c1eb54abf66
7
- data.tar.gz: 394d89daddae630912035d43eefc6ab1a591a45eee3b305b203983cc40c673ad83feb65a3c9510d9a6534311f5c70af7726c83356a64cc6c35a4d2e6949512ee
6
+ metadata.gz: 362211783818b1906bfa90fb42979084e9f1d2bdf7e893313ad5b1d0ef7f2184e1441661221a8df78cfcd530231f7011e678091f26900e041d06414ec92ff116
7
+ data.tar.gz: ad30e2d1b2fddd5f72ec7c939f275ab098586400d70f4f8d6b4e0e4453c30bd63a32c10b6ebc68d815d8e6bde3aaddd041d50b4bb4b8342f84eb23419d31dda7
@@ -0,0 +1,13 @@
1
+ module Monolens
2
+ module Coerce
3
+ class Array
4
+ include Lens
5
+
6
+ signature(Type::Any, Type::Array)
7
+
8
+ def call(arg, world = {})
9
+ Array(arg)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -22,6 +22,11 @@ module Monolens
22
22
  end
23
23
  module_function :string
24
24
 
25
+ def array(options, registry)
26
+ Array.new(options, registry)
27
+ end
28
+ module_function :array
29
+
25
30
  Monolens.define_namespace 'coerce', self
26
31
  end
27
32
  end
@@ -29,3 +34,4 @@ require_relative 'coerce/date'
29
34
  require_relative 'coerce/date_time'
30
35
  require_relative 'coerce/integer'
31
36
  require_relative 'coerce/string'
37
+ require_relative 'coerce/array'
@@ -2,7 +2,7 @@ module Monolens
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 6
5
- TINY = 2
5
+ TINY = 3
6
6
  end
7
7
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
8
8
  end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe Monolens, 'coerce.array' do
4
+ subject do
5
+ Monolens.lens('coerce.array')
6
+ end
7
+
8
+ it 'works' do
9
+ expect(subject.call(12)).to eql([12])
10
+ expect(subject.call(nil)).to eql([])
11
+ expect(subject.call([12, 13])).to eql([12, 13])
12
+ end
13
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monolens
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-29 00:00:00.000000000 Z
11
+ date: 2024-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -130,6 +130,7 @@ files:
130
130
  - lib/monolens/stdlib/check.rb
131
131
  - lib/monolens/stdlib/check/not_empty.rb
132
132
  - lib/monolens/stdlib/coerce.rb
133
+ - lib/monolens/stdlib/coerce/array.rb
133
134
  - lib/monolens/stdlib/coerce/date.rb
134
135
  - lib/monolens/stdlib/coerce/date_time.rb
135
136
  - lib/monolens/stdlib/coerce/integer.rb
@@ -193,6 +194,7 @@ files:
193
194
  - spec/monolens/stdlib/array/test_join.rb
194
195
  - spec/monolens/stdlib/array/test_map.rb
195
196
  - spec/monolens/stdlib/check/test_not_empty.rb
197
+ - spec/monolens/stdlib/coerce/test_array.rb
196
198
  - spec/monolens/stdlib/coerce/test_date.rb
197
199
  - spec/monolens/stdlib/coerce/test_datetime.rb
198
200
  - spec/monolens/stdlib/coerce/test_integer.rb
@@ -242,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
244
  - !ruby/object:Gem::Version
243
245
  version: '0'
244
246
  requirements: []
245
- rubygems_version: 3.1.4
247
+ rubygems_version: 3.3.27
246
248
  signing_key:
247
249
  specification_version: 4
248
250
  summary: Data transformations inspired by Cambria lenses