Class: SeeingIsBelieving
- Inherits:
-
Object
- Object
- SeeingIsBelieving
- Defined in:
- lib/seeing_is_believing/wrap_expressions.rb,
lib/seeing_is_believing.rb,
lib/seeing_is_believing/code.rb,
lib/seeing_is_believing/safe.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/swap_files.rb,
lib/seeing_is_believing/hash_struct.rb,
lib/seeing_is_believing/binary/config.rb,
lib/seeing_is_believing/binary/engine.rb,
lib/seeing_is_believing/compatibility.rb,
lib/seeing_is_believing/hard_core_ensure.rb,
lib/seeing_is_believing/binary/align_file.rb,
lib/seeing_is_believing/binary/align_line.rb,
lib/seeing_is_believing/binary/align_chunk.rb,
lib/seeing_is_believing/event_stream/events.rb,
lib/seeing_is_believing/binary/comment_lines.rb,
lib/seeing_is_believing/binary/format_comment.rb,
lib/seeing_is_believing/event_stream/consumer.rb,
lib/seeing_is_believing/event_stream/producer.rb,
lib/seeing_is_believing/binary/data_structures.rb,
lib/seeing_is_believing/binary/interline_align.rb,
lib/seeing_is_believing/binary/rewrite_comments.rb,
lib/seeing_is_believing/binary/commentable_lines.rb,
lib/seeing_is_believing/evaluate_by_moving_files.rb,
lib/seeing_is_believing/binary/remove_annotations.rb,
lib/seeing_is_believing/binary/annotate_every_line.rb,
lib/seeing_is_believing/binary/annotate_end_of_file.rb,
lib/seeing_is_believing/event_stream/handlers/debug.rb,
lib/seeing_is_believing/binary/annotate_marked_lines.rb,
lib/seeing_is_believing/wrap_expressions_with_inspect.rb,
lib/seeing_is_believing/event_stream/handlers/update_result.rb,
lib/seeing_is_believing/event_stream/handlers/record_exit_events.rb,
lib/seeing_is_believing/event_stream/handlers/stream_json_events.rb
Overview
sigh need to find a way to join the annotators. They are sinful ugly, kinda hard to work with, and absurdly duplicated.
Defined Under Namespace
Modules: Binary, Compatibility, EventStream, Safe, WrapExpressionsWithInspect Classes: Code, Debugger, EvaluateByMovingFiles, HardCoreEnsure, HashStruct, Options, Result, SwapFiles, TempFileAlreadyExists, WrapExpressions
Constant Summary collapse
- SeeingIsBelievingError =
All our errors will inherit from this so that a user can catch any error generated by this lib
Class.new StandardError
- NoMoreEvents =
EventStream
Class.new SeeingIsBelievingError
- UnknownEvent =
Class.new SeeingIsBelievingError
- VERSION =
'4.0.1'
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
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.
32 33 34 35 36 |
# File 'lib/seeing_is_believing.rb', line 32 def initialize(program, ={}) @program = program @program += "\n" unless @program.end_with? "\n" = Options.new end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
31 32 33 |
# File 'lib/seeing_is_believing.rb', line 31 def end |
Class Method Details
.call(*args) ⇒ Object
27 28 29 |
# File 'lib/seeing_is_believing.rb', line 27 def self.call(*args) new(*args).call end |
Instance Method Details
#call ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/seeing_is_believing.rb', line 38 def call @memoized_result ||= Dir.mktmpdir("seeing_is_believing_temp_dir") { |dir| filename = .filename || File.join(dir, 'program.rb') new_program = .rewrite_code.call @program .debugger.context("REWRITTEN PROGRAM") { new_program } EvaluateByMovingFiles.call \ filename, @program, new_program, event_handler: event_handler(.debugger, .event_handler), provided_input: .stdin, require_files: .require_files, load_path_dirs: .load_path_dirs, encoding: .encoding, timeout_seconds: .timeout_seconds, max_line_captures: .max_line_captures, local_cwd: .local_cwd? .event_handler } end |