active_object 1.3.0 → 1.4.0
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 +4 -4
- data/Rakefile +3 -1
- data/lib/active_object/string.rb +4 -4
- data/lib/active_object/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b908cec473063ce9371f42ad24f3e2160449288d
|
|
4
|
+
data.tar.gz: 372517125c14abffe2e4608b087197b7720ae913
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 58811199b70a9c498ebb85894461c9ce61b1ff2b414018a3373459908ff5d061d7cd465d9f0825d7b91a8028d361cb1673b85f307e5f44db749e97e32e77708d
|
|
7
|
+
data.tar.gz: a335da3d616ac49e2fb1da3655db8fa436287fd6ad470b9a916c1618b41867b510322f6174cdb2e83f0e32d5f3198add747e95c18c78dbc8ae03714c2e35fe62
|
data/Rakefile
CHANGED
data/lib/active_object/string.rb
CHANGED
|
@@ -285,15 +285,15 @@ class String
|
|
|
285
285
|
|
|
286
286
|
unless defined?(Rails)
|
|
287
287
|
def truncate(truncate_at, options={})
|
|
288
|
-
return(dup) unless
|
|
288
|
+
return(dup) unless size > truncate_at
|
|
289
289
|
|
|
290
290
|
omission = options.fetch(:omission, "...")
|
|
291
|
-
|
|
291
|
+
size_with_room_for_omission = truncate_at - omission.size
|
|
292
292
|
|
|
293
293
|
stop = if options.fetch(:separator, false)
|
|
294
|
-
rindex(options.fetch(:separator, ''),
|
|
294
|
+
rindex(options.fetch(:separator, ''), size_with_room_for_omission) || size_with_room_for_omission
|
|
295
295
|
else
|
|
296
|
-
|
|
296
|
+
size_with_room_for_omission
|
|
297
297
|
end
|
|
298
298
|
|
|
299
299
|
"#{self[0, stop]}#{omission}"
|
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: 1.
|
|
4
|
+
version: 1.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Juan Gomez
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-08-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|