Class: Mongodump::DB::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/mongodump/db/base.rb

Direct Known Subclasses

Mongolab, Mongolhq

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arg) ⇒ Base

Returns a new instance of Base.



12
13
14
15
16
17
18
19
# File 'lib/mongodump/db/base.rb', line 12

def initialize(arg)
  if arg.is_a?(String)
    @uri = arg
    parse
  else
    raise IncompatibleArgumentException
  end
end

Instance Attribute Details

#appnameObject

Returns the value of attribute appname.



10
11
12
# File 'lib/mongodump/db/base.rb', line 10

def appname
  @appname
end

#hostnameObject

Returns the value of attribute hostname.



8
9
10
# File 'lib/mongodump/db/base.rb', line 8

def hostname
  @hostname
end

#passwordObject

Returns the value of attribute password.



7
8
9
# File 'lib/mongodump/db/base.rb', line 7

def password
  @password
end

#portObject

Returns the value of attribute port.



9
10
11
# File 'lib/mongodump/db/base.rb', line 9

def port
  @port
end

#protocolObject

Returns the value of attribute protocol.



5
6
7
# File 'lib/mongodump/db/base.rb', line 5

def protocol
  @protocol
end

#uriObject

Returns the value of attribute uri.



4
5
6
# File 'lib/mongodump/db/base.rb', line 4

def uri
  @uri
end

#usernameObject

Returns the value of attribute username.



6
7
8
# File 'lib/mongodump/db/base.rb', line 6

def username
  @username
end

Instance Method Details

#has_all_attributes?Boolean

Returns:

  • (Boolean)


21
22
23
24
25
26
27
# File 'lib/mongodump/db/base.rb', line 21

def has_all_attributes?
  for variable in [@uri, @protocol, @username, @password, @hostname, @port, @appname]
    if variable.blank?
      return false
    end
  end
end