Class: Grape::Endpoint::Options
- Inherits:
-
Data
- Object
- Data
- Grape::Endpoint::Options
- Defined in:
- lib/grape/endpoint/options.rb
Overview
Immutable value object holding the keyword inputs passed to Grape::Endpoint.new. Internal to Grape::Endpoint, which builds it from the **options Hash in #initialize so the public options reader stays a plain Hash for downstream gems (e.g. grape-swagger). :method is renamed to :http_methods on the value object to avoid shadowing Object#method via the generated Data accessor.
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#for ⇒ Object
readonly
Returns the value of attribute for.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#forward_match ⇒ Object
readonly
Returns the value of attribute forward_match.
-
#http_methods ⇒ Object
readonly
Returns the value of attribute http_methods.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#route_options ⇒ Object
readonly
Returns the value of attribute route_options.
Instance Method Summary collapse
-
#initialize(path:, method:, route_options: {}, app: nil, format: nil, forward_match: nil, **rest) ⇒ Options
constructor
A new instance of Options.
Constructor Details
#initialize(path:, method:, route_options: {}, app: nil, format: nil, forward_match: nil, **rest) ⇒ Options
Returns a new instance of Options.
12 13 14 15 16 |
# File 'lib/grape/endpoint/options.rb', line 12 def initialize(path:, method:, route_options: {}, app: nil, format: nil, forward_match: nil, **rest) path = Array(path) path << '/' if path.empty? super(path:, http_methods: Array(method), route_options:, app:, format:, forward_match:, **rest) end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app
11 12 13 |
# File 'lib/grape/endpoint/options.rb', line 11 def app @app end |
#for ⇒ Object (readonly)
Returns the value of attribute for
11 12 13 |
# File 'lib/grape/endpoint/options.rb', line 11 def for @for end |
#format ⇒ Object (readonly)
Returns the value of attribute format
11 12 13 |
# File 'lib/grape/endpoint/options.rb', line 11 def format @format end |
#forward_match ⇒ Object (readonly)
Returns the value of attribute forward_match
11 12 13 |
# File 'lib/grape/endpoint/options.rb', line 11 def forward_match @forward_match end |
#http_methods ⇒ Object (readonly)
Returns the value of attribute http_methods
11 12 13 |
# File 'lib/grape/endpoint/options.rb', line 11 def http_methods @http_methods end |
#path ⇒ Object (readonly)
Returns the value of attribute path
11 12 13 |
# File 'lib/grape/endpoint/options.rb', line 11 def path @path end |
#route_options ⇒ Object (readonly)
Returns the value of attribute route_options
11 12 13 |
# File 'lib/grape/endpoint/options.rb', line 11 def @route_options end |