class Exercise::Output

Public Class Methods

new(string) click to toggle source
Calls superclass method
# File lib/commands/exercise/output.rb, line 6
def initialize(string)
  string = string.scrub
  bytes = string.bytes.delete_if { |byte| byte == 27 }
  string = bytes.pack('U*')
  super normalise(string.chomp)
end

Public Instance Methods

to_ansible_output() click to toggle source
# File lib/commands/exercise/output.rb, line 13
def to_ansible_output
  Ansible.new(self)
end
to_cic_output() click to toggle source
# File lib/commands/exercise/output.rb, line 17
def to_cic_output
  CIC.new(self)
end
to_pytest_output() click to toggle source
# File lib/commands/exercise/output.rb, line 21
def to_pytest_output
  Pytest.new(self)
end

Private Instance Methods

normalise(string) click to toggle source
# File lib/commands/exercise/output.rb, line 27
def normalise(string)
  string.gsub(/\[[\d;]+m/, '')
end