lib/subtitle.rb in undertexter-0.0.3 vs lib/subtitle.rb in undertexter-0.0.4
- old
+ new
@@ -1,6 +1,16 @@
class Subtitle
- attr_accessor :url, :downloads, :cds, :title, :movie_title
+ attr_accessor :details, :downloads, :cds, :title, :movie_title, :url
+
def initialize(args)
args.keys.each { |name| instance_variable_set "@" + name.to_s, args[name] }
end
+
+ def url
+ "http://www.undertexter.se/utext.php?id=#{id}"
+ end
+
+ private
+ def id
+ @details.match(/id=(\d+)/)[1]
+ end
end
\ No newline at end of file