Class: CutePrint::RubyParser Private
- Defined in:
- lib/cute_print/ruby_parser.rb,
lib/cute_print/ruby_parser/block.rb,
lib/cute_print/ruby_parser/wraps_sexp.rb,
lib/cute_print/ruby_parser/method_call.rb,
lib/cute_print/ruby_parser/parsed_code.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
This class is very much cribbed from this excellent code:
https://github.com/sconover/wrong/blob/30475fc5ac9d0f73135d229b1b44c045156a7e7a/lib/wrong/chunk.rb
Defined Under Namespace
Modules: WrapsSexp Classes: Block, MethodCall, ParsedCode
Class Method Summary collapse
- .from_block(block) ⇒ Object private
Instance Method Summary collapse
-
#initialize(path, line_number, &block) ⇒ RubyParser
constructor
private
A new instance of RubyParser.
- #parse ⇒ Object private
Constructor Details
#initialize(path, line_number, &block) ⇒ RubyParser
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of RubyParser.
20 21 22 23 24 |
# File 'lib/cute_print/ruby_parser.rb', line 20 def initialize(path, line_number, &block) @path = path @line_number = line_number @block = block end |
Class Method Details
.from_block(block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 18 |
# File 'lib/cute_print/ruby_parser.rb', line 15 def self.from_block(block) path, line_number = block.to_proc.source_location new(path, line_number, &block) end |
Instance Method Details
#parse ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 |
# File 'lib/cute_print/ruby_parser.rb', line 26 def parse @parsed ||= parse_source(read_source) end |