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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/getth.rb +11 -2
  3. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d528d1eb258bc69f0aba2bb4d83def2743a44924
4
- data.tar.gz: c0bb7a0d1d26ac78140fc1d07c744e7bc09f1878
3
+ metadata.gz: 2921bea2196706578e434c539142028f5aadb397
4
+ data.tar.gz: caa736569ba28f4a529761c6b0f6d2e536816320
5
5
  SHA512:
6
- metadata.gz: 4e87e6af8fce4181142a04debf38ad19da02927b20bbaaa81db65c16b002d1176d64dd6e244885ef10cfc6d87b50c87768806082d741a644fc00521576aa72a8
7
- data.tar.gz: 3a098ba95a9ea6b5736d492e3e3a403a87ccd4e68d3d236af33b96af3c19e31269574103a4416f6dbedd4323681950fdcf8e8525d15ead29da2242d877a1254a
6
+ metadata.gz: d85ce3fdd2aa48cfb6d532a533b6fe60c05291694ad3949593168e4c17e47a7d7ec90d7f12614e4ee702cc3fbb2c9386546b50145914b09eaec6d776fb7b7fb1
7
+ data.tar.gz: e88c62c50c911ca05b800dbef72d45df122a2a0813d27584fbddbf345b365ec3b2759eebbf1b8f0de4f78deb81fb86b1639a987d839ca7af2a6222196fe4e933
@@ -1,15 +1,24 @@
1
1
  require 'ordinalize'
2
2
 
3
3
  module Getth
4
- (1..10).each do |i|
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
- end
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
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 retrieving
28
- values from strings and arrays. The Array and String classes are monkey-patched
29
- with the module Getth.
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: []