Exception: ZendeskAppsSupport::Validations::JSHintValidationError
- Inherits:
-
ValidationError
- Object
- StandardError
- ValidationError
- ZendeskAppsSupport::Validations::JSHintValidationError
- Defined in:
- lib/zendesk_apps_support/validations/validation_error.rb
Constant Summary
Constants inherited from ValidationError
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#jshint_errors ⇒ Object
readonly
Returns the value of attribute jshint_errors.
Attributes inherited from ValidationError
Class Method Summary collapse
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(filename, jshint_errors) ⇒ JSHintValidationError
constructor
A new instance of JSHintValidationError.
Methods inherited from ValidationError
from_hash, from_json, #to_json, #to_s
Constructor Details
#initialize(filename, jshint_errors) ⇒ JSHintValidationError
Returns a new instance of JSHintValidationError.
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/zendesk_apps_support/validations/validation_error.rb', line 83 def initialize(filename, jshint_errors) errors = jshint_errors.compact.map { |err| "\n L#{err['line']}: #{err['reason']}" }.join('') @filename = filename @jshint_errors = jshint_errors super(:jshint, { file: filename, errors: errors, count: jshint_errors.length }) end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
77 78 79 |
# File 'lib/zendesk_apps_support/validations/validation_error.rb', line 77 def filename @filename end |
#jshint_errors ⇒ Object (readonly)
Returns the value of attribute jshint_errors.
77 78 79 |
# File 'lib/zendesk_apps_support/validations/validation_error.rb', line 77 def jshint_errors @jshint_errors end |
Class Method Details
.vivify(hash) ⇒ Object
79 80 81 |
# File 'lib/zendesk_apps_support/validations/validation_error.rb', line 79 def self.vivify(hash) new(hash['filename'], hash['jshint_errors']) end |
Instance Method Details
#as_json ⇒ Object
94 95 96 97 98 99 100 |
# File 'lib/zendesk_apps_support/validations/validation_error.rb', line 94 def as_json(*) { 'class' => self.class.to_s, 'filename' => filename, 'jshint_errors' => jshint_errors } end |