diff options
author | John Mair <jrmair@gmail.com> | 2012-07-02 02:33:32 +1200 |
---|---|---|
committer | John Mair <jrmair@gmail.com> | 2012-07-02 02:33:32 +1200 |
commit | d2b25cdbbed2f8539fe5f11e5dcf180fc1f3fce8 (patch) | |
tree | b735d11ae900b01140781ca6eb8563a1a6036344 /lib/method_source/code_helpers.rb | |
parent | 6127eb23a14b66bb3ff7506762927c8b27b4db7e (diff) | |
download | method_source-d2b25cdbbed2f8539fe5f11e5dcf180fc1f3fce8.tar.gz |
properly documented :consume parameter
Diffstat (limited to 'lib/method_source/code_helpers.rb')
-rw-r--r-- | lib/method_source/code_helpers.rb | 16 |
1 files changed, 11 insertions, 5 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) |