Class: PRLS::CLI::PLAYSCRIPTS

Inherits:
PRO
  • Object
show all
Defined in:
lib/prls/playscripts.rb

Constant Summary collapse

PLAYSCRIPTS_PLAYS =
[]

Instance Attribute Summary

Attributes inherited from PRO

#author, #blurb, #summary, #title, #url

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PRO

#add_attr, list_details, #need_attr?, new_from_scrape

Constructor Details

#initialize(attributes) ⇒ PLAYSCRIPTS

Returns a new instance of PLAYSCRIPTS.



5
6
7
8
# File 'lib/prls/playscripts.rb', line 5

def initialize(attributes)
    super
    PLAYSCRIPTS_PLAYS << self
end

Class Method Details

.allObject



10
11
12
# File 'lib/prls/playscripts.rb', line 10

def self.all
    PLAYSCRIPTS_PLAYS
end

.get_details(index) ⇒ Object



27
28
29
30
31
# File 'lib/prls/playscripts.rb', line 27

def self.get_details(index)
    if self.all[index].need_attr?
        self.all[index].add_attr(PRLS::CLI::Scraper.new.playscripts_info(self.all[index].url))
    end
end

.get_playsObject



14
15
16
17
18
19
# File 'lib/prls/playscripts.rb', line 14

def self.get_plays
    if self.all.empty?
        url = "https://www.playscripts.com/find-a-play?sort=recentpopularity"
        self.new_from_scrape(PRLS::CLI::Scraper.new.playscripts_index(url))
    end
end

.list_playsObject



21
22
23
24
25
# File 'lib/prls/playscripts.rb', line 21

def self.list_plays
    puts ""
    puts "Here are Playscripts, Inc.'s featured plays:"
    super
end