Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Up to version 0.2, +bumf

  • Loading branch information...
commit ce19884a199b9628fa512001318769b73afd3033 1 parent b57950c
@ConradIrwin authored
View
1  .gitignore
@@ -1,4 +1,5 @@
*.gem
*.so
*.o
+.rvmrc
ext/Makefile
View
19 LICENSE.MIT
@@ -0,0 +1,19 @@
+Copyright (c) 2011 Conrad Irwin <conrad.irwin@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
38 README.md
@@ -0,0 +1,38 @@
+The `ruby18_source_location` gem backports the `source_location` instance method of `Method`, `UnboundMethod` and
+`Proc` from Ruby 1.9.
+
+This allows you to use `Method#source_location` on ruby 1.8.7, and also all the other gems that depend on it.
+
+Usage
+-----
+
+ gem install ruby18_source_location
+
+```ruby
+ require 'rubygems'
+ require 'ruby18_source_location'
+
+ def example
+ 2
+ end
+
+ puts method(:example).source_location.inspect
+ # => ["/tmp/example.rb", 4]
+
+ puts Proc.new{}.source_location.inspect
+ # => ["/tmp/example.rb", 11]
+
+ puts method(:puts).source_location.inspect
+ # => nil
+```
+
+Known issues
+------------
+
+Under Ruby-1.8.7, it's not currently possible to get the `source_location` of methods defined by `attr_reader`,
+`attr_writer` or `attr_accessor`, unless you are running Ruby Enterprise Edition.
+
+Meta-foo
+--------
+
+This is made available under the MIT license (see LICENSE.MIT), contributions and bug reports are welcome.
View
4 ruby18_source_location.gemspec
@@ -1,14 +1,14 @@
Gem::Specification.new do |s|
s.name = "ruby18_source_location"
- s.version = "0.1"
+ s.version = "0.2"
s.platform = Gem::Platform::RUBY
s.author = "Conrad Irwin"
s.email = "conrad.irwin@gmail.com"
s.homepage = "http://github.com/ConradIrwin/ruby18_source_location"
s.summary = "Add .source_location to methods in Ruby 1.8.7"
s.description = "Allows you to make use of lots of ruby 1.9.2 specific goodness"
- s.files = Dir["ext/*.{c,rb}"]
+ s.files = `git ls-files`.split("\n")
s.extensions = "ext/extconf.rb"
s.require_path = "ext"
end
Please sign in to comment.
Something went wrong with that request. Please try again.