This file contains hidden or 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
group :development, :test do | |
gem 'ruby-debug', :platforms => :ruby_18 | |
gem 'ruby-debug19', :platforms => :ruby_19 | |
end |
This file contains hidden or 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 'rubygems' | |
require 'test/unit' | |
require 'redgreen' | |
class Card | |
attr_reader :suite, :value | |
def initialize(options={}) | |
@suite = options[:suite] | |
@value = options[:value] |
This file contains hidden or 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
like_this :when => "called", | |
:like => "this" | |
like_that(when, signature, is, like, this) |
This file contains hidden or 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
LANG= | |
LC_COLLATE="C" | |
LC_CTYPE="UTF-8" | |
LC_MESSAGES="C" | |
LC_MONETARY="C" | |
LC_NUMERIC="C" | |
LC_TIME="C" | |
LC_ALL= |
This file contains hidden or 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
class Company < ActiveRecord::Base | |
def update_with_password(params={}) | |
if params[:password].blank? | |
params.delete(:password) | |
params.delete(:password_confirmation) if params[:password_confirmation].blank? | |
end | |
update_attributes(params) | |
end | |
This file contains hidden or 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
ATTRIBUTES_ORDERED_FOR_CREATING_GUIDS = [:guid, :url, :content, :summary] | |
def self.guid_from_entry(entry) | |
def entry.can_make_guid_with?(symbol) | |
respond_to?(symbol) && send(symbol).present? | |
end | |
def entry.make_guid_from(symbol) | |
Digest::MD5.hexdigest(send(symbol)) | |
end | |
ATTRIBUTES_ORDERED_FOR_CREATING_GUIDS.each do |symbol| |
This file contains hidden or 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 self.guid_from_entry(entry) | |
def entry.available_for_guid?(sym) | |
respond_to?(sym) && send(sym).present? | |
end | |
[:guid, :url, :content, :summary].each do |sym| | |
entry.available_for_guid?(sym) and return Digest::MD5.hexdigest(entry.send(sym)) | |
end | |
end |
This file contains hidden or 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 self.guid_from_entry(entry) | |
[:guid, :url, :content, :summary].each do |sym| | |
entry.respond_to?(sym) and entry.send(sym).present? and return Digest::MD5.hexdigest(entry.send(sym)) | |
end | |
end |
This file contains hidden or 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 self.guid_from_entry(entry) | |
result = '' | |
[:guid, :url, :content, :summary].each do |sym| | |
next unless entry.respond_to?(sym) and entry.send(sym).present? | |
result = Digest::MD5.hexdigest(entry.send(sym)) | |
break | |
end | |
result | |
end |
This file contains hidden or 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 self.guid_from_entry(entry) | |
if entry.respond_to?(:guid) && entry.guid.present? | |
Digest::MD5.hexdigest(entry.guid.to_s) | |
elsif entry.respond_to?(:url) && entry.url.present? | |
Digest::MD5.hexdigest(entry.url.to_s) | |
elsif entry.respond_to?(:content) && entry.content.present? | |
Digest::MD5.hexdigest(entry.content.to_s) | |
else entry.respond_to?(:summary) && entry.summary.present? | |
Digest::MD5.hexdigest(entry.summary.to_s) | |
end |