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.
@@ -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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "ruby_extendsions"
5
- s.version = "0.1.2"
5
+ s.version = "0.1.3"
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ["blackanger"]
8
8
  s.email = ["blackanger.z@gmail.com"]
data/spec/hash_spec.rb CHANGED
@@ -13,4 +13,5 @@ describe "RubyExtend::HashExtendsions" do
13
13
  require 'ruby_extendsions'
14
14
  @hash1.hash_reverse.should eql({1=>:a, 2=>:b} )
15
15
  end
16
+
16
17
  end
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: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
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