Class: PG::URL

Inherits:
Object
  • Object
show all
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.0'

Class Method Summary collapse

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

.promptObject Also known as: request, >>


56
# File 'lib/pg/url/prompt.rb', line 56

def prompt() Prompt.new.request end