Class: AppIdentity::Versions::Base
- Inherits:
-
Object
- Object
- AppIdentity::Versions::Base
- Defined in:
- lib/app_identity/versions.rb
Overview
:nodoc:
Direct Known Subclasses
Class Method Summary collapse
-
.defined ⇒ Object
:nodoc:.
-
.inherited(subclass) ⇒ Object
:nodoc:.
-
.instance ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#check_nonce!(nonce, _config) ⇒ Object
:nodoc:.
-
#inspect ⇒ Object
:nodoc:.
-
#make_digest(raw) ⇒ Object
:nodoc:.
Class Method Details
.defined ⇒ Object
:nodoc:
15 16 17 |
# File 'lib/app_identity/versions.rb', line 15 def defined # :nodoc: @defined ||= {} end |
.inherited(subclass) ⇒ Object
:nodoc:
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/app_identity/versions.rb', line 23 def inherited(subclass) # :nodoc: match = /V(?<version>\d+)\z/.match(subclass.name) return unless match version = match[:version].to_i raise AppIdentity::Error, "version is not unique" if Base.defined.has_key?(version) subclass.define_method(:version) { version } Base.defined[version] = subclass.instance end |
.instance ⇒ Object
:nodoc:
19 20 21 |
# File 'lib/app_identity/versions.rb', line 19 def instance # :nodoc: @_instance = new end |
Instance Method Details
#check_nonce!(nonce, _config) ⇒ Object
:nodoc:
50 51 52 53 54 55 |
# File 'lib/app_identity/versions.rb', line 50 def check_nonce!(nonce, _config) # :nodoc: raise AppIdentity::Error, "nonce must not be nil" if nonce.nil? raise AppIdentity::Error, "nonce must be a string" unless nonce.is_a?(String) raise AppIdentity::Error, "nonce must not be blank" if nonce.empty? raise AppIdentity::Error, "nonce must not contain colon characters" if /:/.match?(nonce) end |
#inspect ⇒ Object
:nodoc:
42 43 44 45 46 47 48 |
# File 'lib/app_identity/versions.rb', line 42 def inspect # :nodoc: parts = [self.class] parts << "version=#{version}" if respond_to?(:version) parts << "nonce=#{nonce_type}" if respond_to?(:nonce_type) parts << "digest=#{digest_algorithm}" if respond_to?(:digest_algorithm) "#<#{parts.join(" ")}>" end |
#make_digest(raw) ⇒ Object
:nodoc:
38 39 40 |
# File 'lib/app_identity/versions.rb', line 38 def make_digest(raw) # :nodoc: digest_algorithm.hexdigest(raw).upcase end |