Class: Mongoid::Shell::Commands::Mongo

Inherits:
Base
  • Object
show all
Includes:
Properties::Database, Properties::Password, Properties::Primary, Properties::Username
Defined in:
lib/mongoid/shell/commands/mongo.rb

Instance Attribute Summary collapse

Attributes included from Properties::Password

#password

Attributes included from Properties::Username

#username

Attributes included from Properties::Database

#db

Attributes included from Properties::Primary

#primary

Attributes inherited from Base

#session

Instance Method Summary collapse

Methods inherited from Base

#cmd, command_for, #to_s

Constructor Details

#initialize(attrs = {}) ⇒ Mongo

Returns a new instance of Mongo.



12
13
14
# File 'lib/mongoid/shell/commands/mongo.rb', line 12

def initialize(attrs = {})
  super
end

Instance Attribute Details

#evalObject

Returns the value of attribute eval.



10
11
12
# File 'lib/mongoid/shell/commands/mongo.rb', line 10

def eval
  @eval
end

#ipv6Object

Returns the value of attribute ipv6.



10
11
12
# File 'lib/mongoid/shell/commands/mongo.rb', line 10

def ipv6
  @ipv6
end

#nodbObject

Returns the value of attribute nodb.



10
11
12
# File 'lib/mongoid/shell/commands/mongo.rb', line 10

def nodb
  @nodb
end

#norcObject

Returns the value of attribute norc.



10
11
12
# File 'lib/mongoid/shell/commands/mongo.rb', line 10

def norc
  @norc
end

#quietObject

Returns the value of attribute quiet.



10
11
12
# File 'lib/mongoid/shell/commands/mongo.rb', line 10

def quiet
  @quiet
end

Instance Method Details

#host_port_and_dbObject



16
17
18
# File 'lib/mongoid/shell/commands/mongo.rb', line 16

def host_port_and_db
  [primary, db].compact.join('/')
end

#vargsObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/mongoid/shell/commands/mongo.rb', line 20

def vargs
  super({
    'db address' => :host_port_and_db,
    '--username' => :username,
    '--password' => :password,
    '--eval' => :eval,
    '--nodb' => :nodb,
    '--norc' => :norc,
    '--quiet' => :quiet,
    '--ipv6' => :ipv6
  })
end