Class: Torque::PivotalHTMLParser
- Inherits:
-
Object
- Object
- Torque::PivotalHTMLParser
- Defined in:
- lib/torque/pivotal_html_parser.rb
Instance Method Summary collapse
-
#process_project(project_html_string) ⇒ Object
Returns a list of all Story objects parsed from project_html_string (least recent to most recent date accepted).
-
#process_project_date_filter(project_html_string, accept_from, accept_to) ⇒ Object
Returns a list of Story objects parsed from project_html_string whose date_accepted fields are within acceptable bounds (least recent to most recent date accepted).
Instance Method Details
#process_project(project_html_string) ⇒ Object
Returns a list of all Story objects parsed from project_html_string (least recent to most recent date accepted)
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/torque/pivotal_html_parser.rb', line 35 def process_project(project_html_string) project_html = Nokogiri::HTML(project_html_string) story_html_array = project_html.search('story') story_list = [] story_html_array.each do |story_element| story_list << process_story(story_element) end story_list end |
#process_project_date_filter(project_html_string, accept_from, accept_to) ⇒ Object
Returns a list of Story objects parsed from project_html_string whose date_accepted fields are within acceptable bounds (least recent to most recent date accepted)
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/torque/pivotal_html_parser.rb', line 18 def process_project_date_filter(project_html_string, accept_from, accept_to) story_list = process_project(project_html_string) story_list.select! { |story| (!story.date_accepted.nil? \ && story.date_accepted >= accept_from \ && story.date_accepted <= accept_to) } story_list end |