Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Some more cleanups

  • Loading branch information...
commit a90b963c6c5aefe35a7bb8e8c73a5df3a562b784 1 parent 195d507
@pfleidi pfleidi authored
Showing with 9 additions and 21 deletions.
  1. +7 −15 models/audioformat.rb
  2. +2 −6 models/show.rb
View
22 models/audioformat.rb
@@ -5,23 +5,15 @@ class Audioformat < Model
attribute :suffix
def extension
- if data["extension"] # default to something smart if nothing is declared
- data["extension"]
- else
- ".#{ self.name }"
- end
- end # extension
+ data["extension"] || ".#{ self.name }"
+ end
def suffix
- if data["suffix"] # default to something smart if nothing is declared
- data["suffix"]
- else
- ""
- end
- end # suffix
+ data["suffix"] || ""
+ end
- def file_extension # this is what is used to build an audio file url
+ def file_extension
self.suffix + self.extension
- end # file_extension
+ end
-end # audioformat
+end
View
8 models/show.rb
@@ -11,12 +11,8 @@ class Show < Model
def audioformats
if audioformat_names = data['audioformats']
- if audioformat_names.is_a?(Array)
- audioformats = Array.new
- audioformat_names.each do |format|
- audioformats << Audioformat.first(name: format)
- end
- return audioformats
+ audioformat_names.map do |format|
+ Audioformat.first(name: format)
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.