Class: Vanity::Connection::Specification
- Inherits:
-
Object
- Object
- Vanity::Connection::Specification
- Defined in:
- lib/vanity/connection.rb
Instance Method Summary collapse
-
#initialize(spec) ⇒ Specification
constructor
A new instance of Specification.
- #to_h ⇒ Object
Constructor Details
#initialize(spec) ⇒ Specification
Returns a new instance of Specification.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/vanity/connection.rb', line 64 def initialize(spec) case spec when String @spec = build_specification_hash_from_url(spec) when Hash @spec = if spec[:redis] { adapter: :redis, redis: spec[:redis], } else spec end else raise InvalidSpecification, "Unsupported connection specification: #{spec.inspect}" end validate_specification_hash(@spec) end |
Instance Method Details
#to_h ⇒ Object
84 85 86 |
# File 'lib/vanity/connection.rb', line 84 def to_h @spec end |