summaryrefslogtreecommitdiff
path: root/lib
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 /lib
parent6127eb23a14b66bb3ff7506762927c8b27b4db7e (diff)
downloadmethod_source-d2b25cdbbed2f8539fe5f11e5dcf180fc1f3fce8.tar.gz
properly documented :consume parameter
Diffstat (limited to 'lib')
-rw-r--r--lib/method_source/code_helpers.rb16
-rw-r--r--lib/method_source/version.rb2
2 files changed, 12 insertions, 6 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