synecdoche 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -37,9 +37,6 @@ Synecdoche should work on any Ruby. It's only been tested on Ruby
37
37
 
38
38
  ## Installation
39
39
 
40
- _Note: The gem hasn't been published yet and I haven't added the
41
- Rakefile yet. These tasks will be done soon._
42
-
43
40
  If your system is set up to allow it, you can just do
44
41
 
45
42
  gem install synecdoche
@@ -29,10 +29,24 @@ module Synecdoche
29
29
 
30
30
  def method_source_in_class method_name, class_name
31
31
  raise "No file parsed" unless @file
32
+ method_name = handle_special_methods(method_name.to_sym)
32
33
  klass = @file.classes.find{|c| c.name == class_name.to_s}
33
- klass.method_list.find do |m|
34
+ method_info = klass.method_list.find do |m|
34
35
  m.name == method_name.to_s
35
- end.tokens_to_s
36
+ end
37
+ raise "Could not find method '#{method_name.to_s}' in class '#{class_name.to_s}' in file '#{@file_name}'" unless method_info
38
+ method_info.tokens_to_s
39
+ end
40
+
41
+ private
42
+
43
+ def handle_special_methods method_name
44
+ case method_name
45
+ when :initialize
46
+ :new
47
+ else
48
+ method_name
49
+ end
36
50
  end
37
51
  end
38
52
  end
@@ -2,7 +2,7 @@ module Synecdoche
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 0
5
+ PATCH = 1
6
6
  PRE = nil
7
7
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synecdoche
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
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-08-24 00:00:00.000000000 Z
12
+ date: 2012-09-04 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Include parts of a class in another class.
15
15
  email: