Class: Versionist::VersioningStrategy::Default
- Defined in:
- lib/versionist/versioning_strategy/default.rb
Overview
Implements the default version handling strategy.
Instance Attribute Summary collapse
-
#module ⇒ Object
Returns the value of attribute module.
-
#strategies ⇒ Object
Returns the value of attribute strategies.
Attributes inherited from Base
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(config) ⇒ Default
constructor
A new instance of Default.
- #matches?(request) ⇒ Boolean
Constructor Details
#initialize(config) ⇒ Default
Returns a new instance of Default.
8 9 10 11 12 13 |
# File 'lib/versionist/versioning_strategy/default.rb', line 8 def initialize(config) super @module = config[:module] raise ArgumentError, "[VERSIONIST] attempt to set more than one default api version" if !Versionist.configuration.default_version.nil? && Versionist.configuration.default_version != self Versionist.configuration.default_version = self end |
Instance Attribute Details
#module ⇒ Object
Returns the value of attribute module.
6 7 8 |
# File 'lib/versionist/versioning_strategy/default.rb', line 6 def module @module end |
#strategies ⇒ Object
Returns the value of attribute strategies.
5 6 7 |
# File 'lib/versionist/versioning_strategy/default.rb', line 5 def strategies @strategies end |
Instance Method Details
#==(other) ⇒ Object
19 20 21 22 23 |
# File 'lib/versionist/versioning_strategy/default.rb', line 19 def ==(other) super return false if !other.is_a?(Versionist::VersioningStrategy::Default) return self.module == other.module end |
#matches?(request) ⇒ Boolean
15 16 17 |
# File 'lib/versionist/versioning_strategy/default.rb', line 15 def matches?(request) !header_matches?(request) && !parameter_matches?(request) end |