Class: ApipieDSL::ExceptionDescription
- Inherits:
-
Object
- Object
- ApipieDSL::ExceptionDescription
- Defined in:
- lib/apipie_dsl/exception_description.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
Class Method Summary collapse
Instance Method Summary collapse
- #docs ⇒ Object
-
#initialize(error_or_options, desc = nil, options = {}) ⇒ ExceptionDescription
constructor
A new instance of ExceptionDescription.
Constructor Details
#initialize(error_or_options, desc = nil, options = {}) ⇒ ExceptionDescription
Returns a new instance of ExceptionDescription.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/apipie_dsl/exception_description.rb', line 12 def initialize(, desc = nil, = {}) if .is_a?(Hash) = .transform_keys(&:to_sym) @error = [:error] @metadata = [:meta] @description = [:desc] || [:description] else @error = if .is_a?(Symbol) Rack::Utils::SYMBOL_TO_STATUS_CODE[] else end raise ArgumentError, unless @error @metadata = [:meta] @description = desc end end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
5 6 7 |
# File 'lib/apipie_dsl/exception_description.rb', line 5 def description @description end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
5 6 7 |
# File 'lib/apipie_dsl/exception_description.rb', line 5 def error @error end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
5 6 7 |
# File 'lib/apipie_dsl/exception_description.rb', line 5 def @metadata end |
Class Method Details
.from_dsl_data(args) ⇒ Object
7 8 9 10 |
# File 'lib/apipie_dsl/exception_description.rb', line 7 def self.from_dsl_data(args) , desc, = args ApipieDSL::ExceptionDescription.new(, desc, ) end |
Instance Method Details
#docs ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/apipie_dsl/exception_description.rb', line 31 def docs { error: error, description: ApipieDSL.markup_to_html(description), metadata: } end |