Class: GitLab::CI::Lint::Serializer
- Inherits:
-
Object
- Object
- GitLab::CI::Lint::Serializer
- Defined in:
- lib/gitlab/ci/lint/serializer.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
Instance Method Summary collapse
- #failure ⇒ Object
-
#initialize(content) ⇒ Serializer
constructor
A new instance of Serializer.
- #serialize ⇒ Object
- #success ⇒ Object
Constructor Details
#initialize(content) ⇒ Serializer
Returns a new instance of Serializer.
7 8 9 10 11 12 |
# File 'lib/gitlab/ci/lint/serializer.rb', line 7 def initialize content @content = content @sucess_message = "Your GitLab CI File is Okay.".colorize(:green) @failure_message = "Your GitLab CI File is Invalid.".colorize(:red) @serialize = serialize end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
5 6 7 |
# File 'lib/gitlab/ci/lint/serializer.rb', line 5 def content @content end |
Instance Method Details
#failure ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/gitlab/ci/lint/serializer.rb', line 27 def failure puts """ Result: #{@failure_message} #{"Information".colorize(:yellow)} * Status: #{@serialize[:status].colorize(:red)} * Erros: #{@serialize[:errors].to_s.colorize(:red)} Baaaaaad GitLab CI! Fuck man, you're a idiot... """ puts "Error Details:\n".colorize(:yellow) @content["errors"].each_with_index do |value, index| puts "Error #{index} - #{value}" end puts end |
#serialize ⇒ Object
45 46 47 48 49 50 |
# File 'lib/gitlab/ci/lint/serializer.rb', line 45 def serialize { :status => @content["status"], :error => @content["errors"] } end |
#success ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/gitlab/ci/lint/serializer.rb', line 14 def success puts """ Result: #{@sucess_message} Information: * Status: #{@serialize[:status]} * Erros: #{@serialize[:errors]} Yeaaaah!!!! Congrats!!!! """ end |