Class: PG::URL
- Inherits:
-
Object
- Object
- PG::URL
- Defined in:
- lib/pg/url.rb,
lib/pg/url/type.rb,
lib/pg/url/error.rb,
lib/pg/url/prompt.rb,
lib/pg/url/version.rb,
lib/pg/url/generator.rb
Defined Under Namespace
Modules: Error
Constant Summary collapse
- PARAMS =
%i[host port database username password]
- ALLOW_EMPTY =
%i[host port password]
- VERSION =
'0.1.2'
Class Method Summary collapse
- .new(**params) ⇒ Object (also: [])
- .prompt ⇒ Object
Class Method Details
.new(**params) ⇒ Object Also known as: []
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/pg/url.rb', line 13 def new(**params) if ((PARAMS-ALLOW_EMPTY)-params.keys).empty? required = {} (PARAMS-(PARAMS-params.keys)).each{|k|required[k] = params[k]} Type.check(required) Generator.new(params).to_s else raise Error::MissingParams.new((PARAMS-ALLOW_EMPTY)-params.keys) end end |
.prompt ⇒ Object
56 |
# File 'lib/pg/url/prompt.rb', line 56 def prompt() Prompt.new.request end |