This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'indextank' | |
client = IndexTank::Client.new("http://my-indextank-api-url.api.indextank.com") | |
index = client.indexes("my_index_name") | |
index.add() | |
print "Waiting for index to be ready" | |
while not index.running? | |
print "." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem install 'indextank' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Tweet | |
def save | |
puts 'Tweet saved' | |
end | |
end | |
class Foo | |
include Tweet # Add methods from Tweet as Instances Methods | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def withdraw account_number, withdrawal_amount do | |
account = Account.find account_number | |
unless account.sufficient_funds? withdrawal_amount do | |
raise "Insufficient funds" | |
end | |
#...more code... | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Account withdraw(long accountNumber, BigDecimal withdrawalAmount) { | |
Account account = accountDao.get(accountNumber); | |
if(!account.hasSufficientFunds(withdrawalAmount)) { | |
throw new InsufficientFundsException(); | |
} | |
//some code here | |
return account; |
NewerOlder