class MostHauntedCli::America
Constants
- INDEXES
Attributes
description[RW]
id[RW]
location[RW]
name[RW]
Public Class Methods
all()
click to toggle source
# File lib/most_haunted/america.rb, line 39 def self.all @@all end
america_descriptions(input)
click to toggle source
# File lib/most_haunted/america.rb, line 59 def self.america_descriptions(input) input.each do |i| description = MostHauntedCli::Scraper.scrape_america_descriptions.children[i].text puts description.scan(/.{1,73}/).join("\n") puts "" end end
create(array)
click to toggle source
# File lib/most_haunted/america.rb, line 27 def self.create(array) array.each do |unparsed_info| parsed_info = unparsed_info.split(",", 2) name = parsed_info[0] location = parsed_info[1] id = unparsed_info.split(".")[0].to_i description = indexes[id-1] self.new(id, name, location, description) end end
find_description_by_input(input)
click to toggle source
# File lib/most_haunted/america.rb, line 55 def self.find_description_by_input(input) self.all[input.to_i - 1].description end
found(input)
click to toggle source
# File lib/most_haunted/america.rb, line 47 def self.found(input) self.all.find{|america| america.id == input.to_i} end
indexes()
click to toggle source
# File lib/most_haunted/america.rb, line 43 def self.indexes INDEXES.each{|range| (range).to_a } end
list_location_names()
click to toggle source
# File lib/most_haunted/america.rb, line 51 def self.list_location_names self.all.each{|l| puts "#{l.name}"} end
new(id, name, location, description)
click to toggle source
# File lib/most_haunted/america.rb, line 19 def initialize(id, name, location, description) @id = id @name = name @location = location @description = description @@all << self end