Class: Lino::Executors::Mock::Execution

Inherits:
Object
  • Object
show all
Defined in:
lib/lino/executors/mock.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(state) ⇒ Execution

Returns a new instance of Execution.



85
86
87
88
89
90
91
92
# File 'lib/lino/executors/mock.rb', line 85

def initialize(state)
  @command_line = state[:command_line]
  @opts = state[:opts]
  @exit_code = state[:exit_code]
  @stdin_contents = state[:stdin_contents]
  @stdout_contents = state[:stdout_contents]
  @stderr_contents = state[:stderr_contents]
end

Instance Attribute Details

#command_lineObject (readonly)

Returns the value of attribute command_line.



78
79
80
# File 'lib/lino/executors/mock.rb', line 78

def command_line
  @command_line
end

#exit_codeObject (readonly)

Returns the value of attribute exit_code.



78
79
80
# File 'lib/lino/executors/mock.rb', line 78

def exit_code
  @exit_code
end

#optsObject (readonly)

Returns the value of attribute opts.



78
79
80
# File 'lib/lino/executors/mock.rb', line 78

def opts
  @opts
end

#stderr_contentsObject (readonly)

Returns the value of attribute stderr_contents.



78
79
80
# File 'lib/lino/executors/mock.rb', line 78

def stderr_contents
  @stderr_contents
end

#stdin_contentsObject (readonly)

Returns the value of attribute stdin_contents.



78
79
80
# File 'lib/lino/executors/mock.rb', line 78

def stdin_contents
  @stdin_contents
end

#stdout_contentsObject (readonly)

Returns the value of attribute stdout_contents.



78
79
80
# File 'lib/lino/executors/mock.rb', line 78

def stdout_contents
  @stdout_contents
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



106
107
108
109
# File 'lib/lino/executors/mock.rb', line 106

def ==(other)
  self.class == other.class &&
    state_array == other.state_array
end

#hashObject



113
114
115
# File 'lib/lino/executors/mock.rb', line 113

def hash
  [self.class, state_array].hash
end

#with_stderr_contents(contents) ⇒ Object



102
103
104
# File 'lib/lino/executors/mock.rb', line 102

def with_stderr_contents(contents)
  Execution.new(state_hash.merge(stderr_contents: contents))
end

#with_stdin_contents(contents) ⇒ Object



94
95
96
# File 'lib/lino/executors/mock.rb', line 94

def with_stdin_contents(contents)
  Execution.new(state_hash.merge(stdin_contents: contents))
end

#with_stdout_contents(contents) ⇒ Object



98
99
100
# File 'lib/lino/executors/mock.rb', line 98

def with_stdout_contents(contents)
  Execution.new(state_hash.merge(stdout_contents: contents))
end