Class: Grape::DSL::VersionOptions
- Inherits:
-
Data
- Object
- Data
- Grape::DSL::VersionOptions
- Defined in:
- lib/grape/dsl/version_options.rb
Overview
Immutable value object holding the resolved options from Grape::DSL::Routing#version. Stored on the inheritable settings as namespace_inheritable[:version_options] and read by internal call sites (‘Path`, `Endpoint`, `API::Instance#cascade?`, `Middleware::Versioner::Base`) via accessors.
Defaults are duplicated on #initialize here and on #version‘s signature on purpose: keeping them on both sides means each entry point is self-documenting without needing to import a shared constant — the DSL signature shows what a user sees in the IDE, and the Data object has working defaults when constructed directly (middleware `DEFAULT_OPTIONS`, spec fixtures, etc.). The two must stay in lockstep.
Instance Attribute Summary collapse
-
#cascade ⇒ Object
readonly
Returns the value of attribute cascade.
-
#parameter ⇒ Object
readonly
Returns the value of attribute parameter.
-
#strict ⇒ Object
readonly
Returns the value of attribute strict.
-
#using ⇒ Object
readonly
Returns the value of attribute using.
-
#vendor ⇒ Object
readonly
Returns the value of attribute vendor.
Instance Method Summary collapse
-
#initialize(using: :path, cascade: true, parameter: 'apiver', strict: false, vendor: nil) ⇒ VersionOptions
constructor
A new instance of VersionOptions.
Constructor Details
#initialize(using: :path, cascade: true, parameter: 'apiver', strict: false, vendor: nil) ⇒ VersionOptions
Returns a new instance of VersionOptions.
18 19 20 |
# File 'lib/grape/dsl/version_options.rb', line 18 def initialize(using: :path, cascade: true, parameter: 'apiver', strict: false, vendor: nil) super end |
Instance Attribute Details
#cascade ⇒ Object (readonly)
Returns the value of attribute cascade
17 18 19 |
# File 'lib/grape/dsl/version_options.rb', line 17 def cascade @cascade end |
#parameter ⇒ Object (readonly)
Returns the value of attribute parameter
17 18 19 |
# File 'lib/grape/dsl/version_options.rb', line 17 def parameter @parameter end |
#strict ⇒ Object (readonly)
Returns the value of attribute strict
17 18 19 |
# File 'lib/grape/dsl/version_options.rb', line 17 def strict @strict end |
#using ⇒ Object (readonly)
Returns the value of attribute using
17 18 19 |
# File 'lib/grape/dsl/version_options.rb', line 17 def using @using end |
#vendor ⇒ Object (readonly)
Returns the value of attribute vendor
17 18 19 |
# File 'lib/grape/dsl/version_options.rb', line 17 def vendor @vendor end |