Permalink
Browse files

modify

  • Loading branch information...
0 parents commit 48f9baa6b57688e948a8794f31e395165e7928af @ZhangHanDong committed Oct 26, 2010
Showing with 57 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +4 −0 Gemfile
  3. +2 −0 Rakefile
  4. +2 −0 lib/ruby_extend.rb
  5. +21 −0 lib/ruby_extend/hash_extendsions.rb
  6. +3 −0 lib/ruby_extend/version.rb
  7. +22 −0 ruby_extend.gemspec
@@ -0,0 +1,3 @@
+pkg/*
+*.gem
+.bundle
@@ -0,0 +1,4 @@
+source :gemcutter
+
+# Specify your gem's dependencies in ruby_extend.gemspec
+gemspec
@@ -0,0 +1,2 @@
+require 'bundler'
+Bundler::GemHelper.install_tasks
@@ -0,0 +1,2 @@
+require 'ruby_extend/hash_extendsions'
+
@@ -0,0 +1,21 @@
+module RubyExtend
+ module HashExtendsions
+ def self.included(base)
+ base.send :include, InstanceMethods
+ end
+
+ module InstanceMethods
+ def hash_reverse
+ hash_new = {}
+ self.each {|key,value|
+ if not hash_new.has_key?(key) then hash_new[value] = key end
+ }
+ return hash_new
+ end
+ end
+ end
+end
+
+class Hash
+ include RubyExtend::HashExtendsions
+end
@@ -0,0 +1,3 @@
+module RubyExtend
+ VERSION = "0.0.1"
+end
@@ -0,0 +1,22 @@
+# -*- encoding: utf-8 -*-
+require File.expand_path("../lib/ruby_extend/version", __FILE__)
+
+Gem::Specification.new do |s|
+ s.name = "ruby_extend"
+ s.version = RubyExtend::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.authors = []
+ s.email = []
+ s.homepage = "http://rubygems.org/gems/ruby_extend"
+ s.summary = "TODO: Write a gem summary"
+ s.description = "TODO: Write a gem description"
+
+ s.required_rubygems_version = ">= 1.3.6"
+ s.rubyforge_project = "ruby_extend"
+
+ s.add_development_dependency "bundler", ">= 1.0.0"
+
+ s.files = `git ls-files`.split("\n")
+ s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
+ s.require_path = 'lib'
+end

0 comments on commit 48f9baa

Please sign in to comment.