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.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/vanity/connection.rb', line 66 def initialize(spec) case spec when String @spec = build_specification_hash_from_url(spec) when Hash if spec[:redis] @spec = { adapter: :redis, redis: spec[:redis] } else @spec = spec end else raise InvalidSpecification.new("Unsupported connection specification: #{spec.inspect}") end validate_specification_hash(@spec) end |
Instance Method Details
#to_h ⇒ Object
86 87 88 |
# File 'lib/vanity/connection.rb', line 86 def to_h @spec end |