cmeiklejohn-aws 2.3.13 → 2.3.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/cmeiklejohn/string.rb +31 -7
  2. metadata +4 -4
@@ -1,9 +1,33 @@
1
- #
2
- # Hack to add in 1.8.6 support for ruby. Doesn't work in 1.8.6 unless
3
- # active support is loaded, since each_char isn't available until 1.8.7
4
- #
5
- class String
6
- def each_char
7
- self.split("").each { |i| yield i }
1
+ if RUBY_VERSION <= "1.8.6"
2
+ # Hack to add in 1.8.6 support for ruby. Doesn't work in 1.8.6 unless
3
+ # active support is loaded, since each_char isn't available until 1.8.7
4
+ #
5
+ class String
6
+
7
+ if !defined? ActiveSupport
8
+ def each_char
9
+ if block_given?
10
+ scan(/./m) do |x|
11
+ yield x
12
+ end
13
+ else
14
+ scan(/./m)
15
+ end
16
+ end
17
+ end
18
+
19
+ # TODO: Implement seperator
20
+ # See http://ruby-doc.org/core-1.8.7/classes/String.html#M000775
21
+ def lines
22
+ if block_given?
23
+ each_line do |x|
24
+ yield x
25
+ end
26
+ else
27
+ to_a
28
+ end
29
+ end
30
+
8
31
  end
32
+
9
33
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cmeiklejohn-aws
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 37
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 3
9
- - 13
10
- version: 2.3.13
9
+ - 19
10
+ version: 2.3.19
11
11
  platform: ruby
12
12
  authors:
13
13
  - Christopher Meiklejohn
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-07-09 00:00:00 -04:00
21
+ date: 2010-07-15 00:00:00 -04:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency