respond_to_missing 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Sean Huber (shuber@huberry.com)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,17 @@
1
+ = respond_to_missing
2
+
3
+ Defines <tt>{Object#respond_to_missing?}[http://www.ruby-doc.org/core/classes/Object.html#M001006]</tt> and patches <tt>{Object#respond_to?}[http://www.ruby-doc.org/core/classes/Object.html#M001005]</tt> unless this functionality has already been implemented (ruby v1.9+)
4
+
5
+
6
+ == Installation
7
+
8
+ gem install respond_to_missing
9
+
10
+
11
+ == Note on Patches/Pull Requests
12
+
13
+ * Fork the project.
14
+ * Make your feature addition or bug fix.
15
+ * Add tests for it. This is important so I don't break it in a future version unintentionally.
16
+ * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
17
+ * Send me a pull request. Bonus points for topic branches.
@@ -0,0 +1,22 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ desc 'Default: run unit tests'
6
+ task :default => :test
7
+
8
+ desc 'Test the respond_to_missing gem'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs += ['lib', 'test']
11
+ t.pattern = 'test/**/*_test.rb'
12
+ t.verbose = true
13
+ end
14
+
15
+ desc 'Generate documentation for the respond_to_missing gem'
16
+ Rake::RDocTask.new(:rdoc) do |rdoc|
17
+ rdoc.rdoc_dir = 'rdoc'
18
+ rdoc.title = 'respond_to_missing'
19
+ rdoc.options << '--line-numbers' << '--inline-source'
20
+ rdoc.rdoc_files.include('README*')
21
+ rdoc.rdoc_files.include('lib/**/*.rb')
22
+ end
@@ -0,0 +1,14 @@
1
+ # Defines <tt>Object#respond_to_missing?</tt> and patches <tt>Object#respond_to?</tt> unless this functionality has already been implemented (ruby v1.9+)
2
+ module RespondToMissing
3
+ autoload :Version, 'respond_to_missing/version'
4
+
5
+ def respond_to?(method, include_private = false)
6
+ super || respond_to_missing?(method, include_private)
7
+ end
8
+
9
+ def respond_to_missing?(method, include_private)
10
+ false
11
+ end
12
+ end
13
+
14
+ Object.send(:include, RespondToMissing) unless respond_to?(:respond_to_missing?)
@@ -0,0 +1,17 @@
1
+ module RespondToMissing
2
+ # Contains information about this gem's version
3
+ module Version
4
+ MAJOR = 0
5
+ MINOR = 0
6
+ PATCH = 0
7
+
8
+ # Returns a version string by joining <tt>MAJOR</tt>, <tt>MINOR</tt>, and <tt>PATCH</tt> with <tt>'.'</tt>
9
+ #
10
+ # Example
11
+ #
12
+ # Version.to_s # '1.0.2'
13
+ def self.to_s
14
+ [MAJOR, MINOR, PATCH].join('.')
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+ require File.expand_path('../test_helper', __FILE__)
2
+
3
+ class RespondToMissingTest < Test::Unit::TestCase
4
+ module Mock
5
+ def self.respond_to_missing?(method, include_private)
6
+ method == :testing || super
7
+ end
8
+ end
9
+
10
+ def test_should_respond_to_respond_to_missing
11
+ assert respond_to?(:respond_to_missing?)
12
+ end
13
+
14
+ def test_should_pass_failing_respond_to_calls_to_respond_to_missing
15
+ assert Mock.respond_to?(:testing)
16
+ assert !Mock.respond_to?(:undefined_method)
17
+ end
18
+ end
@@ -0,0 +1,5 @@
1
+ require 'test/unit'
2
+
3
+ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
+ $:.unshift(File.dirname(__FILE__))
5
+ require 'respond_to_missing'
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: respond_to_missing
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 0
10
+ version: 0.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Sean Huber
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-04-01 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Defines Object#respond_to_missing? and patches Object#respond_to? unless this functionality has already been implemented (ruby v1.9+)
23
+ email: shuber@huberry.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - lib/respond_to_missing/version.rb
32
+ - lib/respond_to_missing.rb
33
+ - MIT-LICENSE
34
+ - Rakefile
35
+ - README.rdoc
36
+ - test/respond_to_missing_test.rb
37
+ - test/test_helper.rb
38
+ has_rdoc: true
39
+ homepage: http://github.com/shuber/respond_to_missing
40
+ licenses: []
41
+
42
+ post_install_message:
43
+ rdoc_options:
44
+ - --line-numbers
45
+ - --inline-source
46
+ - --main
47
+ - README.rdoc
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ hash: 3
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ hash: 3
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ requirements: []
69
+
70
+ rubyforge_project:
71
+ rubygems_version: 1.6.2
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: Defines Object#respond_to_missing? and patches Object#respond_to?
75
+ test_files:
76
+ - test/respond_to_missing_test.rb
77
+ - test/test_helper.rb