Class: Topsy::Page

Inherits:
Hashie::Dash
  • Object
show all
Defined in:
lib/topsy/page.rb

Constant Summary collapse

@@windows =
{'a' => :all, 'auto' => :auto, 'w' => :week, 'd' => :day, 'm' => :month, 'h' => :hour}

Instance Method Summary collapse

Constructor Details

#initialize(content, klass) ⇒ Page

Returns a new instance of Page.



33
34
35
36
# File 'lib/topsy/page.rb', line 33

def initialize(content, klass)
  @klass = klass
  super(content)
end

Instance Method Details

#list=(value) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/topsy/page.rb', line 38

def list=(value)
  result = []
  if value
    value.each{ |x| result << @klass.new(x) }
    self[:list] = result  
  else
    self[:list] = value
  end
end

#to_sObject



29
30
31
# File 'lib/topsy/page.rb', line 29

def to_s
  "Topsy Page: #{page} of #{total}, #{list.size} authors"
end

#window=(value) ⇒ Object



48
49
50
51
52
# File 'lib/topsy/page.rb', line 48

def window=(value)
  if value
    self[:window] = @@windows[value]  
  end
end