active_object 4.0.13 → 4.0.14

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0af37321a91317b8d25371fb0b08f35b64eb65ec
4
- data.tar.gz: 4768af3d81ae21baff77cdb6582d12545d9528b8
3
+ metadata.gz: 5f31cda51ca069ea0b9c95761a8e47a2bee4f790
4
+ data.tar.gz: 271e61ac209c8214f07dbd886e8e5c3817955055
5
5
  SHA512:
6
- metadata.gz: f7338a890b66d3b688cc15077db61fa5b2f7a7cab86fb8860adb7f6a0d648abff36172b5b13813f2494d945dbf67c2651727d0c966db45d127c15eb5fcd02aa5
7
- data.tar.gz: ad3c1d0a26a12c65152512e3e1f0771baa98c29535b1325049bec89922f36862f9c1f903ccdb28c86457b807e5b78ead379c7c0bd098a6785741ba2645c4f66e
6
+ metadata.gz: 2a81cf6dce0eaa75ffcd73834b03e438df483bb645c6b5e2538e29f4702b7f9f7fdb78c11869153c2f733178e86fff7a527918c0576d753c65929020c400396a
7
+ data.tar.gz: e26ccb4cdb9cf6bb64a959c9864d08961b322b2c0f2021379493acb47e4c5b39692214fbd4a3140c1d1f1eb3e392e0809bb2d890705c31459b7560bee284efb1
data/README.md CHANGED
@@ -36,9 +36,9 @@ Or install it yourself as:
36
36
  * [Integer](#integer)
37
37
  * [Numeric](#numeric)
38
38
  * [Object](#object)
39
- * [Range](#Rrange)
39
+ * [Range](#range)
40
40
  * [String](#string)
41
- * [Time](#time)
41
+ * [DateTime](#datetime)
42
42
 
43
43
  ## Configuration
44
44
 
@@ -158,8 +158,15 @@ end
158
158
  %w(1 2 3 4 5 6 7 8 9 10).in_groups_of(3, false) #=> [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9'], ['10']]
159
159
  ```
160
160
 
161
+ **Merge:**
162
+ `merge` concats multiple arrays.
163
+
164
+ ```ruby
165
+ [1, 2].merge([3, 4], [5, 6]) #=> [1, 2, 3, 4, 5, 6]
166
+ ```
167
+
161
168
  **Nillify:**
162
- `nillify` and `nillify!` converts blank vlaues into nils.
169
+ `nillify` and `nillify!` converts blank values into nils.
163
170
 
164
171
  ```ruby
165
172
  [' ', 3, 4].nillify #=> [nil, 3, 4]
@@ -167,7 +174,7 @@ end
167
174
  ```
168
175
 
169
176
  **Probablity:**
170
- `probability` generates a hash mapping each unique element in the array to the relative frequency, i.e. the probablity, of it appearence.
177
+ `probability` generates a hash mapping each unique element in the array to the relative frequency, i.e. the probability, of it appearance.
171
178
 
172
179
  ```ruby
173
180
  [:a, :b, :c, :c].probability #=> { a: 0.25, b: 0.25, c: 0.5 }
@@ -288,7 +295,7 @@ end
288
295
 
289
296
  ```ruby
290
297
  [].exactly?(1) #=> false
291
- [1,2,3].excatly?(3) #=> true
298
+ [1,2,3].exactly?(3) #=> true
292
299
  [1,1,3,3].exactly?(2, &:even?) #=> false
293
300
  ```
294
301
 
@@ -1088,7 +1095,7 @@ h.slice!(:a, :b) #=> { c: 3, d: 4 }
1088
1095
  ```
1089
1096
 
1090
1097
  **Pad:**
1091
- `pad` returns a string reprensentation of the number padded with pad_num to a specified length.
1098
+ `pad` returns a string representation of the number padded with pad_num to a specified length.
1092
1099
 
1093
1100
  ```ruby
1094
1101
  3.pad #=> '003'
@@ -1264,7 +1271,7 @@ h.slice!(:a, :b) #=> { c: 3, d: 4 }
1264
1271
  `to_time` converts a time unit from one unit to another unit.
1265
1272
 
1266
1273
  ```ruby
1267
- 120.to_time(:seconds, :mintues) #=> 2 #MIN
1274
+ 120.to_time(:seconds, :minutes) #=> 2 #MIN
1268
1275
  3.to_time(:hours, :days) #=> 3 #DAY
1269
1276
  2.to_time(:days, :seconds) #=> 172800 #SEC
1270
1277
  1825.to_time(:days, :years) #=> 4.996577686516085 #YR
@@ -1548,7 +1555,7 @@ false.truthy? #=> false
1548
1555
  ```
1549
1556
 
1550
1557
  **Camelize:**
1551
- `camelize` and `camelize!` transfroms a string to camelcase.
1558
+ `camelize` and `camelize!` transforms a string to camelcase.
1552
1559
 
1553
1560
  ```ruby
1554
1561
  'example_string'.camelize #=> 'ExampleString'
@@ -1784,9 +1791,9 @@ false.truthy? #=> false
1784
1791
  `remove_tags` and `remove_tags!` removes HTML tags from a string.
1785
1792
 
1786
1793
  ```ruby
1787
- 'example'.strip_tags #=> 'example'
1788
- '<a href='http://example.com'>click</a>'.strip_tags #=> 'click'
1789
- 'this is <b>bold</b> and <em>emphatic</em>'.strip_tags #=> 'this is bold and emphatic'
1794
+ 'example'.remove_tags #=> 'example'
1795
+ '<a href='http://example.com'>click</a>'.remove_tags #=> 'click'
1796
+ 'this is <b>bold</b> and <em>emphatic</em>'.remove_tags #=> 'this is bold and emphatic'
1790
1797
  ```
1791
1798
 
1792
1799
  **Sample:**
@@ -1928,7 +1935,7 @@ false.truthy? #=> false
1928
1935
  'this thing that thing'.unshift('this ', 'that ') #=> 'this that this thing that thing'
1929
1936
  ```
1930
1937
 
1931
- ## Time
1938
+ ## DateTime
1932
1939
 
1933
1940
  *Note:* also works with Date class.
1934
1941
 
@@ -108,6 +108,11 @@ module ActiveObject::Array
108
108
  end
109
109
  # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
110
110
 
111
+ def merge(*values)
112
+ values.each { |val| concat(val) }
113
+ self
114
+ end
115
+
111
116
  def nillify
112
117
  map { |val| !val.nil? && (val.try(:blank?) || val.try(:to_s).blank?) ? nil : val }
113
118
  end
@@ -201,6 +201,7 @@ module Enumerable
201
201
  end
202
202
  end
203
203
 
204
+ # rubocop:disable Metrics/MethodLength
204
205
  def percentile(num, identity = 0)
205
206
  return identity unless length.positive?
206
207
 
@@ -217,6 +218,7 @@ module Enumerable
217
218
  collection_sorted[rank - 1]
218
219
  end
219
220
  end
221
+ # rubocop:enable Metrics/MethodLength
220
222
 
221
223
  def range(identity = 0)
222
224
  return identity unless length.positive?
@@ -1,3 +1,3 @@
1
1
  module ActiveObject
2
- VERSION = '4.0.13'.freeze
2
+ VERSION = '4.0.14'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_object
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.13
4
+ version: 4.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-09 00:00:00.000000000 Z
11
+ date: 2017-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable