Class: SeeingIsBelieving
- Inherits:
-
Object
- Object
- SeeingIsBelieving
- Defined in:
- lib/seeing_is_believing.rb,
lib/seeing_is_believing/line.rb,
lib/seeing_is_believing/error.rb,
lib/seeing_is_believing/binary.rb,
lib/seeing_is_believing/result.rb,
lib/seeing_is_believing/version.rb,
lib/seeing_is_believing/debugger.rb,
lib/seeing_is_believing/has_exception.rb,
lib/seeing_is_believing/parser_helpers.rb,
lib/seeing_is_believing/hard_core_ensure.rb,
lib/seeing_is_believing/wrap_expressions.rb,
lib/seeing_is_believing/binary/align_file.rb,
lib/seeing_is_believing/binary/align_line.rb,
lib/seeing_is_believing/binary/clean_body.rb,
lib/seeing_is_believing/binary/parse_args.rb,
lib/seeing_is_believing/binary/align_chunk.rb,
lib/seeing_is_believing/binary/comment_lines.rb,
lib/seeing_is_believing/binary/add_annotations.rb,
lib/seeing_is_believing/binary/rewrite_comments.rb,
lib/seeing_is_believing/binary/comment_formatter.rb,
lib/seeing_is_believing/binary/commentable_lines.rb,
lib/seeing_is_believing/evaluate_by_moving_files.rb
Overview
comprehensive list of syntaxes that can come up github.com/whitequark/parser/blob/master/doc/AST_FORMAT.md
Defined Under Namespace
Modules: HasException, ParserHelpers Classes: Binary, BugInSib, Debugger, EvaluateByMovingFiles, HardCoreEnsure, Line, RecordedException, Result, TempFileAlreadyExists, WrapExpressions
Constant Summary collapse
- BLANK_REGEX =
/\A\s*\Z/
- SeeingIsBelievingError =
all our errors will inherit from this so that a user can catch any error generated by this lib
Class.new StandardError
- VERSION =
'2.0.1'
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(program, options = {}) ⇒ SeeingIsBelieving
constructor
A new instance of SeeingIsBelieving.
Constructor Details
#initialize(program, options = {}) ⇒ SeeingIsBelieving
Returns a new instance of SeeingIsBelieving.
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/seeing_is_believing.rb', line 19 def initialize(program, ={}) @program = program @matrix_filename = [:matrix_filename] @filename = [:filename] @stdin = to_stream .fetch(:stdin, '') @require = .fetch :require, [] @load_path = .fetch :load_path, [] @encoding = .fetch :encoding, nil @timeout = [:timeout] @debugger = .fetch :debugger, Debugger.new(stream: nil) @ruby_executable = .fetch :ruby_executable, 'ruby' @number_of_captures = .fetch :number_of_captures, Float::INFINITY end |
Class Method Details
.call(*args) ⇒ Object
15 16 17 |
# File 'lib/seeing_is_believing.rb', line 15 def self.call(*args) new(*args).call end |
Instance Method Details
#call ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/seeing_is_believing.rb', line 33 def call @memoized_result ||= begin new_program = program_that_will_record_expressions debugger.context("TRANSLATED PROGRAM") { new_program } result = result_for new_program debugger.context("RESULT") { result.inspect } result end end |