Class: Screencast

Inherits:
Object
  • Object
show all
Defined in:
lib/peepcode.rb

Constant Summary collapse

URL =
URI 'https://peepcode.com/screencasts'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#imageObject (readonly)

Returns the value of attribute image.



6
7
8
# File 'lib/peepcode.rb', line 6

def image
  @image
end

Returns the value of attribute link.



6
7
8
# File 'lib/peepcode.rb', line 6

def link
  @link
end

#titleObject (readonly)

Returns the value of attribute title.



6
7
8
# File 'lib/peepcode.rb', line 6

def title
  @title
end

Class Method Details

.allObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/peepcode.rb', line 8

def self.all 
  i = 0 
  screencasts = []
  count = self.titles.length
  while i < count
    sc = Screencast.new( titles[i], image_urls[i], links[i] ) 
    screencasts << sc
    i += 1
  end 
  screencasts.collect(&:to_json) 
end

Instance Method Details

#to_jsonObject



20
21
22
23
24
25
26
# File 'lib/peepcode.rb', line 20

def to_json 
  {   
    title: @title,
    image: @image,
    link: @link
  }   
end