Class: SeeingIsBelieving::Binary::AddAnnotations

Inherits:
Object
  • Object
show all
Includes:
HasException
Defined in:
lib/seeing_is_believing/binary/add_annotations.rb

Instance Attribute Summary collapse

Attributes included from HasException

#exception

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uncleaned_body, options = {}, &annotater) ⇒ AddAnnotations

Returns a new instance of AddAnnotations.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/seeing_is_believing/binary/add_annotations.rb', line 26

def initialize(uncleaned_body, options={}, &annotater)
  self.options = options
  self.body    = CleanBody.call uncleaned_body, !xmpfilter_style
  self.results = SeeingIsBelieving.call body,
                                        filename:           (options[:as] || options[:filename]),
                                        require:            options[:require],
                                        load_path:          options[:load_path],
                                        encoding:           options[:encoding],
                                        stdin:              options[:stdin],
                                        timeout:            options[:timeout],
                                        debugger:           debugger,
                                        ruby_executable:    options[:shebang],
                                        number_of_captures: options[:number_of_captures]
end

Instance Attribute Details

#resultsObject

Returns the value of attribute results.



25
26
27
# File 'lib/seeing_is_believing/binary/add_annotations.rb', line 25

def results
  @results
end

Class Method Details

.method_from_options(*args) ⇒ Object



15
16
17
# File 'lib/seeing_is_believing/binary/add_annotations.rb', line 15

def self.method_from_options(*args)
  define_method(args.first) { options.fetch *args }
end

Instance Method Details

#callObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/seeing_is_believing/binary/add_annotations.rb', line 41

def call
  @new_body ||= begin
    new_body = if xmpfilter_style
                 body_with_updated_annotations
               else
                 body_with_everything_annotated
               end

    add_stdout_stderr_and_exceptions_to new_body

    debugger.context "OUTPUT"
    new_body
  end
end