ruby_patch 0.0.0 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,6 +21,10 @@ module RubyPatch
21
21
  File.expand_path(dir)
22
22
  end
23
23
 
24
+ def __METHOD__()
25
+ parse_caller(caller(1).first)[:method]
26
+ end
27
+
24
28
  # Create a deep clone by using Marshal.
25
29
  def deep_clone()
26
30
  Marshal.load(Marshal.dump(self))
@@ -5,4 +5,8 @@ class String
5
5
 
6
6
  "#{q_left}#{self}#{q_right}"
7
7
  end
8
+
9
+ def alphanumeric()
10
+ self.gsub(/\W/, '_')
11
+ end
8
12
  end
@@ -1,3 +1,3 @@
1
1
  module RubyPatch
2
- VERSION = '0.0.0'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -9,6 +9,16 @@ describe Object do
9
9
  end
10
10
  end
11
11
 
12
+ describe '#__METHOD__' do
13
+ it do
14
+ def __method__spec()
15
+ __METHOD__
16
+ end
17
+
18
+ __method__spec.should == '__method__spec'
19
+ end
20
+ end
21
+
12
22
  describe '#deep_clone' do
13
23
  it do
14
24
  @a = [1]
@@ -11,11 +11,19 @@ describe String do
11
11
  end
12
12
 
13
13
  context 'one arg' do
14
- 'a'.quote('->').should == '->a->'
14
+ it do
15
+ 'a'.quote('->').should == '->a->'
16
+ end
15
17
  end
16
18
 
17
19
  context 'two args' do
18
- 'a'.quote("\e[30m", "\e[0m").should == "\e[30ma\e[0m"
20
+ it do
21
+ 'a'.quote("\e[30m", "\e[0m").should == "\e[30ma\e[0m"
22
+ end
19
23
  end
20
24
  end
25
+
26
+ describe '#alphanumeric' do
27
+ 'abcd"&\'(a)'.alphanumeric.should == 'abcd____a_'
28
+ end
21
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_patch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-24 00:00:00.000000000 Z
12
+ date: 2012-06-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &76415490 !ruby/object:Gem::Requirement
16
+ requirement: &74368400 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *76415490
24
+ version_requirements: *74368400
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: simplecov
27
- requirement: &76415070 !ruby/object:Gem::Requirement
27
+ requirement: &74368150 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *76415070
35
+ version_requirements: *74368150
36
36
  description: Monkey patches used by kshramt's libraries.
37
37
  email:
38
38
  executables: []