Class: ActionSpec::Configuration
- Inherits:
-
Object
- Object
- ActionSpec::Configuration
- Defined in:
- lib/action_spec/configuration.rb
Instance Attribute Summary collapse
-
#default_response_media_type ⇒ Object
Returns the value of attribute default_response_media_type.
-
#error_messages ⇒ Object
Returns the value of attribute error_messages.
-
#invalid_parameters_exception_class ⇒ Object
Returns the value of attribute invalid_parameters_exception_class.
-
#open_api_output ⇒ Object
Returns the value of attribute open_api_output.
-
#open_api_server_url ⇒ Object
Returns the value of attribute open_api_server_url.
-
#open_api_title ⇒ Object
Returns the value of attribute open_api_title.
-
#open_api_version ⇒ Object
Returns the value of attribute open_api_version.
-
#required_allow_blank ⇒ Object
Returns the value of attribute required_allow_blank.
Instance Method Summary collapse
- #dup ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #message_for(attribute, type, options = {}) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/action_spec/configuration.rb', line 9 def initialize @invalid_parameters_exception_class = ActionSpec::InvalidParameters @open_api_output = "docs/openapi.yml" @open_api_title = nil @open_api_version = nil @open_api_server_url = nil @default_response_media_type = :json @required_allow_blank = true @error_messages = ActiveSupport::HashWithIndifferentAccess.new end |
Instance Attribute Details
#default_response_media_type ⇒ Object
Returns the value of attribute default_response_media_type.
5 6 7 |
# File 'lib/action_spec/configuration.rb', line 5 def default_response_media_type @default_response_media_type end |
#error_messages ⇒ Object
Returns the value of attribute error_messages.
7 8 9 |
# File 'lib/action_spec/configuration.rb', line 7 def @error_messages end |
#invalid_parameters_exception_class ⇒ Object
Returns the value of attribute invalid_parameters_exception_class.
5 6 7 |
# File 'lib/action_spec/configuration.rb', line 5 def invalid_parameters_exception_class @invalid_parameters_exception_class end |
#open_api_output ⇒ Object
Returns the value of attribute open_api_output.
5 6 7 |
# File 'lib/action_spec/configuration.rb', line 5 def open_api_output @open_api_output end |
#open_api_server_url ⇒ Object
Returns the value of attribute open_api_server_url.
5 6 7 |
# File 'lib/action_spec/configuration.rb', line 5 def open_api_server_url @open_api_server_url end |
#open_api_title ⇒ Object
Returns the value of attribute open_api_title.
5 6 7 |
# File 'lib/action_spec/configuration.rb', line 5 def open_api_title @open_api_title end |
#open_api_version ⇒ Object
Returns the value of attribute open_api_version.
5 6 7 |
# File 'lib/action_spec/configuration.rb', line 5 def open_api_version @open_api_version end |
#required_allow_blank ⇒ Object
Returns the value of attribute required_allow_blank.
5 6 7 |
# File 'lib/action_spec/configuration.rb', line 5 def required_allow_blank @required_allow_blank end |
Instance Method Details
#dup ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/action_spec/configuration.rb', line 31 def dup self.class.new.tap do |copy| copy.invalid_parameters_exception_class = invalid_parameters_exception_class copy.open_api_output = open_api_output copy.open_api_title = open_api_title copy.open_api_version = open_api_version copy.open_api_server_url = open_api_server_url copy.default_response_media_type = default_response_media_type copy.required_allow_blank = required_allow_blank copy. = .deep_dup end end |
#message_for(attribute, type, options = {}) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/action_spec/configuration.rb', line 24 def (attribute, type, = {}) configured = .dig(attribute.to_sym, type.to_sym) || [type.to_sym] return if configured.blank? configured.respond_to?(:call) ? configured.call(attribute.to_sym, ) : configured end |