Skip to content

Commit fab538e

Browse files
committed
minor: alias #read_primary? with #primary?
1 parent 0d91faf commit fab538e

File tree

4 files changed

+4
-0
lines changed

4 files changed

+4
-0
lines changed

lib/mongo/connection.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ def connected?
470470
def read_primary?
471471
@read_primary
472472
end
473+
alias :primary? :read_primary?
473474

474475
# Close the connection to the database.
475476
def close

lib/mongo/repl_set_connection.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ def connecting?
137137
def read_primary?
138138
!@read_pool || @read_pool.length.zero?
139139
end
140+
alias :primary? :read_primary?
140141

141142
# Close the connection to the database.
142143
def close

test/replica_sets/connect_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def test_connect
3232
[RS.host, RS.ports[2]], :name => RS.name)
3333
assert @conn.connected?
3434
assert @conn.read_primary?
35+
assert @conn.primary?
3536

3637
assert_equal RS.primary, @conn.primary
3738
assert_equal RS.secondaries.sort, @conn.secondaries.sort

test/replica_sets/query_secondaries.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def teardown
1818

1919
def test_read_primary
2020
assert !@conn.read_primary?
21+
assert !@conn.primary?
2122
end
2223

2324
def test_con

0 commit comments

Comments
 (0)