class Shark::SharkRays
Attributes
description[RW]
distribution[RW]
feeding[RW]
habitat[RW]
name[RW]
scientific_name[RW]
taxonomy[RW]
url[RW]
Public Class Methods
all()
click to toggle source
# File lib/shark/sharkrays.rb, line 19 def self.all @@all end
find(id)
click to toggle source
# File lib/shark/sharkrays.rb, line 23 def self.find(id) self.all[id-1] end
new(name = nil, url = nil)
click to toggle source
# File lib/shark/sharkrays.rb, line 13 def initialize(name = nil, url = nil) @name = name @url = "https://oceana.org" +url @@all << self end
new_from_shark_index(shark)
click to toggle source
# File lib/shark/sharkrays.rb, line 6 def self.new_from_shark_index(shark) self.new( shark.css("h1").text, shark.css("a").attr("href").value ) end
Public Instance Methods
doc()
click to toggle source
# File lib/shark/sharkrays.rb, line 27 def doc @doc = Nokogiri::HTML(open(self.url)) end