to_gunma 0.0.1.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ToGunma
2
2
 
3
- TODO: Write a gem description
3
+ to_gunma
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,16 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ ### to_gunma
22
+ ---
23
+ array = [1,2,3]
24
+ array.to_gunma #=> "Arrayは群馬県になりました。"
25
+ array.to_s #=> "[1, 2, 3]"
26
+ array.include?(1) #=> true
27
+
28
+ array.to_gunma! #=> "Arrayは群馬県になりました。"
29
+ array.to_s #=> "Arrayは群馬県になりました。"
30
+ array.include?(1) #=> "Arrayは群馬県になりました。"
22
31
 
23
32
  ## Contributing
24
33
 
@@ -1,6 +1,16 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  class Object
3
- def to_gunma
3
+ def to_gunma *dummy
4
4
  "#{self.class}は群馬県になりました。"
5
5
  end
6
+
7
+ def to_gunma!
8
+ methods = self.class.instance_methods
9
+ class << self
10
+ methods.each do |method|
11
+ alias_method(method.to_sym, :to_gunma) unless method =~ /^\W|^_|to_gunma|^object|^class/
12
+ end
13
+ end
14
+ return to_gunma
15
+ end
6
16
  end
@@ -1,3 +1,3 @@
1
1
  module ToGunma
2
- VERSION = "0.0.1.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -2,13 +2,37 @@
2
2
  require File.expand_path(File.join('../', 'spec_helper'), File.dirname(__FILE__))
3
3
 
4
4
  describe Object do
5
- it "Array should be gunma" do [].to_gunma.should == [].class.to_s+gunma; end
6
- it "nil should be gunma" do nil.to_gunma.should == nil.class.to_s+gunma; end
7
- it "Hash should be gunma" do {}.to_gunma.should == {}.class.to_s+gunma; end
8
- it "String should be gunma" do "".to_gunma.should == "".class.to_s+gunma; end
9
- it "Fixnum should be gunma" do 1.to_gunma.should == 1.class.to_s+gunma; end
10
- it "Float should be gunma" do 1.1.to_gunma.should == 1.1.class.to_s+gunma; end
11
- it "Regexp should be gunma" do //.to_gunma.should == //.class.to_s+gunma; end
12
- it "Time should be gunma" do Time.now.to_gunma.should == Time.now.class.to_s+gunma; end
13
- it "Proc should be gunma" do Proc.new{}.to_gunma.should == Proc.new{}.class.to_s+gunma; end
5
+
6
+ describe ".to_gunma" do
7
+ it "Array should be gunma" do [].to_gunma.should == gunma([].class.to_s); end
8
+ it "nil should be gunma" do nil.to_gunma.should == gunma(nil.class.to_s); end
9
+ it "Hash should be gunma" do {}.to_gunma.should == gunma({}.class.to_s); end
10
+ it "String should be gunma" do "".to_gunma.should == gunma("".class.to_s); end
11
+ it "Fixnum should be gunma" do 1.to_gunma.should == gunma(1.class.to_s); end
12
+ it "Float should be gunma" do 1.1.to_gunma.should == gunma(1.1.class.to_s); end
13
+ it "Regexp should be gunma" do //.to_gunma.should == gunma(//.class.to_s); end
14
+ it "Time should be gunma" do Time.now.to_gunma.should == gunma(Time.now.class.to_s); end
15
+ it "Proc should be gunma" do Proc.new{}.to_gunma.should == gunma(Proc.new{}.class.to_s); end
16
+ end
17
+
18
+ describe ".to_gunma!" do
19
+ before do
20
+ @array = []
21
+ @array.to_gunma!
22
+ @hash = {}
23
+ @hash.to_gunma!
24
+ end
25
+
26
+ it "@array.to_gunma! should be gunma" do @array.to_gunma!.should == gunma([].class.to_s); end
27
+ it "@array.to_s should be gunma" do @array.to_s.should == gunma([].class.to_s); end
28
+ it "@array.include? should be gunma" do @array.include?(1,2,3).should == gunma([].class.to_s); end
29
+ it "@array.== should not be gunma" do @array.==([]).should_not == gunma([].class.to_s); end
30
+ it "@array.__send__ should not be gunma" do @array.__send__(:==,[]).should_not == gunma([].class.to_s); end
31
+ it "@array.object_id should not be gunma" do @array.object_id.should_not == gunma([].class.to_s); end
32
+ it "@hash.to_s should be gunma" do @hash.to_s.should == gunma({}.class.to_s); end
33
+ it "@hash.include? should be gunma" do @hash.include?(1,2,3).should == gunma({}.class.to_s); end
34
+ it "@hash.== should not be gunma" do @hash.==({}).should_not == gunma({}.class.to_s); end
35
+ it "@hash.__send__ should not be gunma" do @hash.__send__(:==,{}).should_not == gunma({}.class.to_s); end
36
+ it "@hash.object_id should not be gunma" do @hash.object_id.should_not == gunma({}.class.to_s); end
37
+ end
14
38
  end
data/spec/spec_helper.rb CHANGED
@@ -2,6 +2,6 @@
2
2
  require 'rubygems'
3
3
  require 'to_gunma'
4
4
 
5
- def gunma
6
- "は群馬県になりました。"
5
+ def gunma(str)
6
+ "#{str}は群馬県になりました。"
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: to_gunma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-01 00:00:00.000000000Z
12
+ date: 2012-06-03 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: to_gunma
15
15
  email: