lib/helpers/sprintly.rb in overview-0.0.8.pre.28 vs lib/helpers/sprintly.rb in overview-0.0.9.pre.30

- old
+ new

@@ -33,18 +33,21 @@ attr_accessor :description attr_accessor :source attr_accessor :type attr_accessor :author attr_accessor :id - attr_accessor :hackpads + attr_accessor :specs attr_accessor :url attr_accessor :parent + attr_accessor :specs - HACKPADURL = "hackpad.com" + def initialize(json) + @specurls = %w(hackpad.com notes.dropbox.com) + type ||="NA" status ||="UNKNOWN" author ||="UNKNOWN" environments ||= [] @@ -55,13 +58,12 @@ @type = json["type"] @status = json["status"] @author = author @url = json["short_url"] @parent = SprintlyItem.new(json["parent"]) if json["parent"] - urls = URI.extract(@description) - @hackpads = urls.select { |u| u.include?(HACKPADURL)}.collect {|u| SprintlyEmbeddedURL.new(u)} + @specs = urls.select { |u| @specurls.any? {|specurl| u.include?(specurl)}}.collect {|u| SprintlyEmbeddedURL.new(u)} end def to_s inspect @@ -104,13 +106,13 @@ end def is_story? return @type.upcase == "STORY" end - def all_hackpads + def all_specs hackpads = Array.new - hackpads.push(self.hackpads) - hackpads.push(self.parent.all_hackpads) if self.parent + hackpads.push(self.specs) + hackpads.push(self.parent.all_specs) if self.parent return hackpads.flatten.uniq end def all_items items = Array.new