Skip to content

Instantly share code, notes, and snippets.

@workmad3
Created July 27, 2010 09:53
Show Gist options
  • Select an option

  • Save workmad3/491996 to your computer and use it in GitHub Desktop.

Select an option

Save workmad3/491996 to your computer and use it in GitHub Desktop.
class List
attr_accessor :per_page, :distribution, :page_count, :item_count
def initialize(per_page=nil)
@per_page = per_page || 21
@page_count = -1
@item_count = -1
@distribution = []
end
end
class ListByCategory < List
attr_reader :category
def initialize(category_id=nil, per_page=nil)
@category = category_id || 'all'
super(per_page)
end
def item_count
puts "ITEM COUNT: " + @item_count.inspect
end
end
=> nil
ListByCategory.new.item_count
ITEM COUNT: -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment