ruby_extendsions 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ruby_extendsions/array_extendsions.rb +27 -0
- data/ruby_extendsions.gemspec +1 -1
- data/spec/hash_spec.rb +1 -0
- metadata +4 -3
@@ -0,0 +1,27 @@
|
|
1
|
+
module RubyExtendsions
|
2
|
+
module ArrayExtendsions
|
3
|
+
def self.included(base)
|
4
|
+
base.send :include, InstanceMethods
|
5
|
+
base.send :extend, ClassMethods
|
6
|
+
end
|
7
|
+
|
8
|
+
module InstanceMethods
|
9
|
+
def fill_nil(val)
|
10
|
+
self.inject([]) {|s, a| s << (a.nil? ? a=val : a)}
|
11
|
+
end
|
12
|
+
|
13
|
+
def fill_nil!(val)
|
14
|
+
self.each_index { |i| self[i] ||= val }
|
15
|
+
end
|
16
|
+
end#InstanceMethods
|
17
|
+
|
18
|
+
module ClassMethods
|
19
|
+
#TODO
|
20
|
+
end#ClassMethods
|
21
|
+
|
22
|
+
end #HashExtendsions
|
23
|
+
end #RubyExtendsions
|
24
|
+
|
25
|
+
class Array
|
26
|
+
include RubyExtendsions::ArrayExtendsions
|
27
|
+
end
|
data/ruby_extendsions.gemspec
CHANGED
data/spec/hash_spec.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_extendsions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- blackanger
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- README.markdown
|
66
66
|
- Rakefile
|
67
67
|
- lib/ruby_extendsions.rb
|
68
|
+
- lib/ruby_extendsions/array_extendsions.rb
|
68
69
|
- lib/ruby_extendsions/hash_extendsions.rb
|
69
70
|
- ruby_extendsions.gemspec
|
70
71
|
- spec/hash_spec.rb
|