Class: StarWarsComics::Series

Inherits:
Object
  • Object
show all
Extended by:
Concerns::Findable
Defined in:
lib/star-wars-comics/series.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Concerns::Findable

find, find_by_name, find_or_create_by_name

Constructor Details

#initialize(name = nil, path = nil) ⇒ Series

Returns a new instance of Series.



7
8
9
10
11
# File 'lib/star-wars-comics/series.rb', line 7

def initialize(name = nil, path = nil)
  @name = name
  @path = path
  @issues = []
end

Instance Attribute Details

#descObject

Returns the value of attribute desc.



4
5
6
# File 'lib/star-wars-comics/series.rb', line 4

def desc
  @desc
end

#end_dateObject

Returns the value of attribute end_date.



4
5
6
# File 'lib/star-wars-comics/series.rb', line 4

def end_date
  @end_date
end

#issuesObject

Returns the value of attribute issues.



4
5
6
# File 'lib/star-wars-comics/series.rb', line 4

def issues
  @issues
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/star-wars-comics/series.rb', line 4

def name
  @name
end

#pathObject

Returns the value of attribute path.



4
5
6
# File 'lib/star-wars-comics/series.rb', line 4

def path
  @path
end

#start_dateObject

Returns the value of attribute start_date.



4
5
6
# File 'lib/star-wars-comics/series.rb', line 4

def start_date
  @start_date
end

#statusObject

Returns the value of attribute status.



4
5
6
# File 'lib/star-wars-comics/series.rb', line 4

def status
  @status
end

#storiesObject

Returns the value of attribute stories.



4
5
6
# File 'lib/star-wars-comics/series.rb', line 4

def stories
  @stories
end

Class Method Details

.allObject



18
19
20
# File 'lib/star-wars-comics/series.rb', line 18

def self.all
  @@all ||= StarWarsComics::Scraper::scrape_series("/wiki/Category:Canon_comics", [])
end

Instance Method Details

#add_issue(issue) ⇒ Object



13
14
15
16
# File 'lib/star-wars-comics/series.rb', line 13

def add_issue(issue)
  issue.series ||= self
  self.issues << issue unless self.issues.include?(issue)
end