getth 0.0.4 → 0.0.5
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/lib/getth.rb +11 -2
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2921bea2196706578e434c539142028f5aadb397
|
4
|
+
data.tar.gz: caa736569ba28f4a529761c6b0f6d2e536816320
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d85ce3fdd2aa48cfb6d532a533b6fe60c05291694ad3949593168e4c17e47a7d7ec90d7f12614e4ee702cc3fbb2c9386546b50145914b09eaec6d776fb7b7fb1
|
7
|
+
data.tar.gz: e88c62c50c911ca05b800dbef72d45df122a2a0813d27584fbddbf345b365ec3b2759eebbf1b8f0de4f78deb81fb86b1639a987d839ca7af2a6222196fe4e933
|
data/lib/getth.rb
CHANGED
@@ -1,15 +1,24 @@
|
|
1
1
|
require 'ordinalize'
|
2
2
|
|
3
3
|
module Getth
|
4
|
-
(
|
4
|
+
(2..10).each do |i|
|
5
5
|
define_method(i.ordinalize) { self[i.pred] }
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
|
+
|
9
10
|
class Array
|
10
11
|
include Getth
|
11
12
|
end
|
12
13
|
|
13
14
|
class String
|
14
15
|
include Getth
|
15
|
-
|
16
|
+
|
17
|
+
def first(n = 1)
|
18
|
+
self[0...n]
|
19
|
+
end
|
20
|
+
|
21
|
+
def last(n = 1)
|
22
|
+
self[-n..-1]
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: getth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sagar Pandya
|
@@ -24,9 +24,10 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
description: This gem defines methods first, second, third ... ninth, tenth for
|
28
|
-
values from strings and arrays. The Array and String classes
|
29
|
-
|
27
|
+
description: This gem defines methods first, second, third ... ninth, tenth etc for
|
28
|
+
retrieving values from strings and arrays. The Array and String classes have been
|
29
|
+
monkey-patched in order to achieve this. Core Array already includes a last-instance-method
|
30
|
+
but since String does not, I have had to add it.
|
30
31
|
email: sarg@outlook.com
|
31
32
|
executables: []
|
32
33
|
extensions: []
|