My Recent Pastes (21 and counting)
All Pasties (over 21 and counting)
Pages: 1 2
Below are summaries of the 15 most recent pasties by Karmen Blake.
March 09, 2008
11:42PM EDT
by Karmen Blake
View more (34 lines)
1 2 3 4 5 |
class Person attr_accessor :name def initialize(name) @name = name end |
March 09, 2008
12:45AM EDT
by Karmen Blake
View more (30 lines)
1 2 3 4 5 |
module Sortable def sort(options={}) attributes = options[:attributes].inject("["){|attribute_string, attribute| attribute_string << "object.#{attribute},"} + "]" options[:collection].sort_by{|object| eval(attributes)} end |
March 05, 2008
12:04AM EDT
by Karmen Blake
View more (36 lines)
1 2 3 4 5 |
class Animal def speak "please override me" end end |
March 04, 2008
11:32PM EDT
by Karmen Blake
View more (22 lines)
1 2 3 4 5 |
class Person attr_accessor :name def greeting "Hello I'm #{@name}" end |
February 24, 2008
11:47PM EDT
by Karmen Blake
View more (95 lines)
1 2 3 4 5 |
a = [1,2,3,4] p a a << 5 p a a.push(6,7,8) |
February 22, 2008
12:58AM EDT
by Karmen Blake
View more (30 lines)
1 2 3 4 5 |
module Sortable def sort(options={}) attributes = options[:attributes].inject("["){|attribute_string, attribute| attribute_string << "object.#{attribute},"} + "]" options[:collection].sort_by{|object| eval(attributes)} end |
February 22, 2008
12:52AM EDT
by Karmen Blake
View more (23 lines)
1 2 3 4 5 |
class Person attr_accessor :lastname,:firstname,:age def initialize(firstname,lastname,age) @lastname = lastname @firstname = firstname |
February 19, 2008
12:40AM EDT
by Karmen Blake
View more (19 lines)
1 2 3 4 5 |
class Person include Comparable attr_accessor :name def initialize(name) @name = name |
February 19, 2008
12:39AM EDT
by Karmen Blake
View more (13 lines)
1 2 3 4 5 |
#comparable operator <=> # natural ordering # 1 2 3 4... # a b c puts 1 <=> 1 |
February 04, 2008
12:15AM EDT
by Karmen Blake
View more (56 lines)
1 2 3 4 5 |
class CourseEvaluation attr_accessor :title,:teacher def initialize(title,teacher) @title,@teacher = title, teacher @comments = [] |
February 04, 2008
12:14AM EDT
by Karmen Blake
View more (55 lines)
1 2 3 4 5 |
module Commentable def initialize @comments = [] end def add_comment(comment) |
January 28, 2008
1:54AM EDT
by Karmen Blake
View more (33 lines)
1 2 3 4 5 |
module ClassMethods def run puts "I'm running..." end end |
January 26, 2008
10:56AM EDT
by Karmen Blake
View more (226 lines)
1 2 3 4 5 |
#RUBYISMS a = b.foo if a.empty? a = b.bar |
January 26, 2008
10:55AM EDT
by Karmen Blake
View more (226 lines)
1 2 3 4 5 |
#RUBYISMS a = b.foo if a.empty? a = b.bar |
January 25, 2008
4:36PM EDT
by Karmen Blake
View more (226 lines)
1 2 3 4 5 |
#RUBYISMS a = b.foo if a.empty? a = b.bar |
Pastie