lib/travis/client/artifact.rb in travis-1.2.2 vs lib/travis/client/artifact.rb in travis-1.2.3
- old
+ new
@@ -1,5 +1,6 @@
+# encoding: utf-8
require 'travis/client'
module Travis
module Client
class Artifact < Entity
@@ -7,11 +8,16 @@
attributes :job_id, :type, :body
# @!parse attr_reader :job
has :job
+ def encoded_body
+ return body unless body.respond_to? :encode
+ body.encode 'utf-8'
+ end
+
def colorized_body
- attributes['colorized_body'] ||= body.gsub(/[^[:print:]\e\n]/, '')
+ attributes['colorized_body'] ||= encoded_body.gsub(/[^[:print:]\e\n]/, '')
end
def clean_body
attributes['clean_body'] ||= colorized_body.gsub(/\e[^m]+m/, '')
end