summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mair <jrmair@gmail.com>2012-07-02 02:33:32 +1200
committerJohn Mair <jrmair@gmail.com>2012-07-02 02:33:32 +1200
commitd2b25cdbbed2f8539fe5f11e5dcf180fc1f3fce8 (patch)
treeb735d11ae900b01140781ca6eb8563a1a6036344
parent6127eb23a14b66bb3ff7506762927c8b27b4db7e (diff)
downloadmethod_source-d2b25cdbbed2f8539fe5f11e5dcf180fc1f3fce8.tar.gz
properly documented :consume parameter
-rw-r--r--lib/method_source/code_helpers.rb16
-rw-r--r--lib/method_source/version.rb2
-rw-r--r--method_source.gemspec4
3 files changed, 14 insertions, 8 deletions
diff --git a/lib/method_source/code_helpers.rb b/lib/method_source/code_helpers.rb
index 9c7e4d7..a3d2a71 100644
--- a/lib/method_source/code_helpers.rb
+++ b/lib/method_source/code_helpers.rb
@@ -7,10 +7,14 @@ module MethodSource
#
# @param [Array<String>, File, String] file The file to parse, either as a File or as
# @param [Fixnum] line_number The line number at which to look.
- # NOTE: The first line in a file is line 1!
- # @param [Boolean] strict If set to true, then only completely valid expressions are
- # returned. Otherwise heuristics are used to extract
- # expressions that may have been valid inside an eval.
+ # NOTE: The first line in a file is
+ # line 1!
+ # @param [Hash] options The optional configuration parameters.
+ # @option options [Boolean] :strict If set to true, then only completely
+ # valid expressions are returned. Otherwise heuristics are used to extract
+ # expressions that may have been valid inside an eval.
+ # @option options [Fixnum] :consume A number of lines to automatically
+ # consume (add to the expression buffer) without checking for validity.
# @return [String] The first complete expression
# @raise [SyntaxError] If the first complete expression can't be identified
def expression_at(file, line_number, options={})
@@ -80,7 +84,9 @@ module MethodSource
# Get the first expression from the input.
#
# @param [Array<String>] lines
- # @param [&Block] a clean-up function to run before checking for complete_expression
+ # @param [Fixnum] consume A number of lines to automatically
+ # consume (add to the expression buffer) without checking for validity.
+ # @yield a clean-up function to run before checking for complete_expression
# @return [String] a valid ruby expression
# @raise [SyntaxError]
def extract_first_expression(lines, consume=0, &block)
diff --git a/lib/method_source/version.rb b/lib/method_source/version.rb
index 36c82c0..f699eb0 100644
--- a/lib/method_source/version.rb
+++ b/lib/method_source/version.rb
@@ -1,3 +1,3 @@
module MethodSource
- VERSION = "0.8.pre.2"
+ VERSION = "0.8.pre.3"
end
diff --git a/method_source.gemspec b/method_source.gemspec
index 1e5c8f0..6fe7097 100644
--- a/method_source.gemspec
+++ b/method_source.gemspec
@@ -2,11 +2,11 @@
Gem::Specification.new do |s|
s.name = "method_source"
- s.version = "0.8.pre.2"
+ s.version = "0.8.pre.3"
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
s.authors = ["John Mair (banisterfiend)"]
- s.date = "2012-06-03"
+ s.date = "2012-06-29"
s.description = "retrieve the sourcecode for a method"
s.email = "jrmair@gmail.com"
s.files = [".gemtest", ".travis.yml", ".yardopts", "Gemfile", "LICENSE", "README.markdown", "Rakefile", "lib/method_source.rb", "lib/method_source/code_helpers.rb", "lib/method_source/source_location.rb", "lib/method_source/version.rb", "method_source.gemspec", "test/test.rb", "test/test_helper.rb"]