Skip to content

Commit

Permalink
Fix linters issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ivaan1992 committed Jun 29, 2022
1 parent 366263b commit 92f3300
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def initialize
@labels = []
end

def process_selection(selection) # rubocop:disable Metrics/CyclomaticComplexity
def process_selection(selection) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
case selection
when '1'
@books.each { |book| puts book.title }
Expand Down
6 changes: 3 additions & 3 deletions movie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class Movie < Item
attr_reader :silent, :title

def initialize(title, genre, source, publish_date, archived: false, silent: true)
def initialize(title, genre, source, publish_date, silent: true)
super(title, publish_date)
@silent = silent
add_genre(genre)
Expand All @@ -12,11 +12,11 @@ def initialize(title, genre, source, publish_date, archived: false, silent: true

def can_be_archived?
return true if super && silent

false
end

def to_hash
{ title: @title, genre: @genre, source: @source, publish_date: @publish_date.strftime('%Y-%m-%d') }
end

end
end
2 changes: 1 addition & 1 deletion movie_creator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ def create_movie
publish_date = gets.chomp

Movie.new(title, genre, source, publish_date)
end
end
end
2 changes: 1 addition & 1 deletion music_album.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class MusicAlbum < Item
attr_reader :on_spotify, :title

def initialize(title, genre, publish_date, archived: false, on_spotify: true)
super(title, publish_date, archived: archived)
super(title, publish_date, archived:)
@on_spotify = on_spotify
add_genre(genre)
end
Expand Down
25 changes: 12 additions & 13 deletions source.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
class Source
attr_accessor :items, :name
def initialize(name)
@id = Random.rand(1...100)
@name = name
@items = []
end
def add_item(item)
@items.push(item)
item.add_source(self)
end
attr_accessor :items, :name

def initialize(name)
@id = Random.rand(1...100)
@name = name
@items = []
end

def add_item(item)
@items.push(item)
item.add_source(self)
end
end

0 comments on commit 92f3300

Please sign in to comment.