Reputation: 2071
There are noticeable difference between Moped::Collection
object instances. The inspection of Item.collection
object is as follows (with line ending added):
#<Moped::Collection:0x007fb381e3ed10
@database=#<Moped::Database:0x007fb381e3fa30
@name="production_datagatherer",
@session=<Moped::Session
seeds=[
<Moped::Node resolved_address="22.22.22.22:43700">,
<Moped::Node resolved_address="22.22.22.22:43700">
]
database=production_datagatherer
>
>,
@name="items"
>
Item.collection
Moped::Collection
object has following instance variables:
@database: Moped::Database object
@name: "items"
@database
variable has the format #<Moped::Database:0x007fb381e3fa30
while @session
instance variable has a Moped::Session
object but it is formatted differently.
@session
not an object? seeds
and database
).Upvotes: 1
Views: 59
Reputation: 1088
It is actually much simplier.
Moped::Session
implements inspect
method
def inspect
"<#{self.class.name} seeds=#{cluster.seeds} database=#{current_database_name}>"
end
that's why it looks different. By default inspect
includes instance variables as it happens with Moped::Collection
.
inspect
method is called on an object when it is printed with p
method, or is returned to console. You can read about inspect
here
Upvotes: 1