class BCrypt::Engine

def self.cost=(cost)

BCrypt::Password.create('secret', :cost => 6).cost #=> 6
# cost can still be overridden as needed

BCrypt::Password.create('secret').cost #=> 8
BCrypt::Engine.cost = 8

BCrypt::Password.create('secret').cost #=> 12
BCrypt::Engine::DEFAULT_COST #=> 12

Example:

creating a password hash.
Set a default cost factor that will be used if one is not specified when
def self.cost=(cost)
  @cost = cost
end