Class: SeeingIsBelieving::EvaluateByMovingFiles
- Inherits:
-
Object
- Object
- SeeingIsBelieving::EvaluateByMovingFiles
- Defined in:
- lib/seeing_is_believing/evaluate_by_moving_files.rb
Instance Attribute Summary collapse
-
#backup_path ⇒ Object
Returns the value of attribute backup_path.
-
#debugger ⇒ Object
Returns the value of attribute debugger.
-
#encoding ⇒ Object
Returns the value of attribute encoding.
-
#event_handler ⇒ Object
Returns the value of attribute event_handler.
-
#file_directory ⇒ Object
Returns the value of attribute file_directory.
-
#file_path ⇒ Object
Returns the value of attribute file_path.
-
#load_path_flags ⇒ Object
Returns the value of attribute load_path_flags.
-
#local_cwd ⇒ Object
Returns the value of attribute local_cwd.
-
#max_line_captures ⇒ Object
Returns the value of attribute max_line_captures.
-
#provided_input ⇒ Object
Returns the value of attribute provided_input.
-
#relative_filename ⇒ Object
Returns the value of attribute relative_filename.
-
#require_flags ⇒ Object
Returns the value of attribute require_flags.
-
#rewritten_program ⇒ Object
Returns the value of attribute rewritten_program.
-
#timeout_seconds ⇒ Object
Returns the value of attribute timeout_seconds.
-
#user_program ⇒ Object
Returns the value of attribute user_program.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(file_path, user_program, rewritten_program, options = {}) ⇒ EvaluateByMovingFiles
constructor
A new instance of EvaluateByMovingFiles.
Constructor Details
#initialize(file_path, user_program, rewritten_program, options = {}) ⇒ EvaluateByMovingFiles
Returns a new instance of EvaluateByMovingFiles.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/seeing_is_believing/evaluate_by_moving_files.rb', line 36 def initialize(file_path, user_program, rewritten_program, ={}) = .dup self.user_program = user_program self.rewritten_program = rewritten_program self.encoding = .delete(:encoding) || "u" self.timeout_seconds = .delete(:timeout_seconds) || 0 # 0 is the new infinity self.provided_input = .delete(:provided_input) || String.new self.event_handler = .delete(:event_handler) || raise(ArgumentError, "must provide an :event_handler") self.load_path_flags = (.delete(:load_path_dirs) || []).flat_map { |dir| ['-I', dir] } self.require_flags = (.delete(:require_files) || ['seeing_is_believing/the_matrix']).map { |filename| ['-r', filename] }.flatten self.max_line_captures = (.delete(:max_line_captures) || Float::INFINITY) # (optimization: child stops producing results at this number, even though it might make more sense for the consumer to stop emitting them) self.local_cwd = .delete(:local_cwd) || false self.file_path = file_path self.file_directory = File.dirname file_path file_name = File.basename file_path self.relative_filename = local_cwd ? file_name : file_path self.backup_path = File.join file_directory, "seeing_is_believing_backup.#{file_name}" .any? && raise(ArgumentError, "Unknown options: #{.inspect}") end |
Instance Attribute Details
#backup_path ⇒ Object
Returns the value of attribute backup_path.
34 35 36 |
# File 'lib/seeing_is_believing/evaluate_by_moving_files.rb', line 34 def backup_path @backup_path end |
#debugger ⇒ Object
Returns the value of attribute debugger.
32 33 34 |
# File 'lib/seeing_is_believing/evaluate_by_moving_files.rb', line 32 def debugger @debugger end |
#encoding ⇒ Object
Returns the value of attribute encoding.
32 33 34 |
# File 'lib/seeing_is_believing/evaluate_by_moving_files.rb', line 32 def encoding @encoding end |
#event_handler ⇒ Object
Returns the value of attribute event_handler.
32 33 34 |
# File 'lib/seeing_is_believing/evaluate_by_moving_files.rb', line 32 def event_handler @event_handler end |
#file_directory ⇒ Object
Returns the value of attribute file_directory.
34 35 36 |
# File 'lib/seeing_is_believing/evaluate_by_moving_files.rb', line 34 def file_directory @file_directory end |
#file_path ⇒ Object
Returns the value of attribute file_path.
34 35 36 |
# File 'lib/seeing_is_believing/evaluate_by_moving_files.rb', line 34 def file_path @file_path end |
#load_path_flags ⇒ Object
Returns the value of attribute load_path_flags.
32 33 34 |
# File 'lib/seeing_is_believing/evaluate_by_moving_files.rb', line 32 def load_path_flags @load_path_flags end |
#local_cwd ⇒ Object
Returns the value of attribute local_cwd.
34 35 36 |
# File 'lib/seeing_is_believing/evaluate_by_moving_files.rb', line 34 def local_cwd @local_cwd end |
#max_line_captures ⇒ Object
Returns the value of attribute max_line_captures.
32 33 34 |
# File 'lib/seeing_is_believing/evaluate_by_moving_files.rb', line 32 def max_line_captures @max_line_captures end |
#provided_input ⇒ Object
Returns the value of attribute provided_input.
32 33 34 |
# File 'lib/seeing_is_believing/evaluate_by_moving_files.rb', line 32 def provided_input @provided_input end |
#relative_filename ⇒ Object
Returns the value of attribute relative_filename.
34 35 36 |
# File 'lib/seeing_is_believing/evaluate_by_moving_files.rb', line 34 def relative_filename @relative_filename end |
#require_flags ⇒ Object
Returns the value of attribute require_flags.
32 33 34 |
# File 'lib/seeing_is_believing/evaluate_by_moving_files.rb', line 32 def require_flags @require_flags end |
#rewritten_program ⇒ Object
Returns the value of attribute rewritten_program.
32 33 34 |
# File 'lib/seeing_is_believing/evaluate_by_moving_files.rb', line 32 def rewritten_program @rewritten_program end |
#timeout_seconds ⇒ Object
Returns the value of attribute timeout_seconds.
32 33 34 |
# File 'lib/seeing_is_believing/evaluate_by_moving_files.rb', line 32 def timeout_seconds @timeout_seconds end |
#user_program ⇒ Object
Returns the value of attribute user_program.
32 33 34 |
# File 'lib/seeing_is_believing/evaluate_by_moving_files.rb', line 32 def user_program @user_program end |
Class Method Details
.call(*args) ⇒ Object
28 29 30 |
# File 'lib/seeing_is_believing/evaluate_by_moving_files.rb', line 28 def self.call(*args) new(*args).call end |