Sha256: e92d5de72eb599dc8220e41c1a4680ba2e3da952ce923562cf2dcc1fe1d19590

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

module JiraIssues
  class JiraIssuesNavigator
    include JiraIssues::JiraIssueStats

    def initialize(issues)
      @issues = issues
    end

    def issues 
      @issues
    end 

    def to_json
      json = []
      @issues.each do |i|
        json << i.to_json
      end
    end

    def all
      JiraIssuesNavigator.new @issues
    end

    def open
      JiraIssuesNavigator.new @issues.select {|i| i[:filter_status] == JiraWorkflow::OPEN}
    end

    def blocked
      JiraIssuesNavigator.new @issues.select {|i| i[:filter_status] == JiraWorkflow::BLOCKED}
    end

    def in_progress
      JiraIssuesNavigator.new @issues.select {|i| i[:filter_status] == JiraWorkflow::IN_PROGRESS}
    end

    def closed
      JiraIssuesNavigator.new @issues.select {|i| i[:filter_status] == JiraWorkflow::CLOSED}
    end

    def with_status(status: selected_status)
      JiraIssuesNavigator.new @issues.select {|i| i[:filter_status] == @issue_states[selected_status]}
    end

    #aliases
    def todo
      open
    end

    def done
      closed
    end 

    def ip 
      in_progress
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jira_issues-0.0.10 lib/jira_issues/jira_issues_navigator.rb
jira_issues-0.0.9 lib/jira_issues/jira_issues_navigator.rb
jira_issues-0.0.8 lib/jira_issues/jira_issues_navigator.rb