Skip to content

Commit

Permalink
minor: alias #read_primary? with #primary?
Browse files Browse the repository at this point in the history
  • Loading branch information
banker committed Jan 17, 2011
1 parent 0d91faf commit fab538e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/mongo/connection.rb
Expand Up @@ -470,6 +470,7 @@ def connected?
def read_primary?
@read_primary
end
alias :primary? :read_primary?

# Close the connection to the database.
def close
Expand Down
1 change: 1 addition & 0 deletions lib/mongo/repl_set_connection.rb
Expand Up @@ -137,6 +137,7 @@ def connecting?
def read_primary?
!@read_pool || @read_pool.length.zero?
end
alias :primary? :read_primary?

# Close the connection to the database.
def close
Expand Down
1 change: 1 addition & 0 deletions test/replica_sets/connect_test.rb
Expand Up @@ -32,6 +32,7 @@ def test_connect
[RS.host, RS.ports[2]], :name => RS.name)
assert @conn.connected?
assert @conn.read_primary?
assert @conn.primary?

assert_equal RS.primary, @conn.primary
assert_equal RS.secondaries.sort, @conn.secondaries.sort
Expand Down
1 change: 1 addition & 0 deletions test/replica_sets/query_secondaries.rb
Expand Up @@ -18,6 +18,7 @@ def teardown

def test_read_primary
assert !@conn.read_primary?
assert !@conn.primary?
end

def test_con
Expand Down

0 comments on commit fab538e

Please sign in to comment.