Sha256: 3a6a8c573edc1b8c94296a54199ca7e5b234e486455abf34f75a7c778f9d0180

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 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[:status] == JiraWorkflow::OPEN}
    end

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

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

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

    def with_status(status: selected_status)
      JiraIssuesNavigator.new @issues.select {|i| i[: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

2 entries across 2 versions & 1 rubygems

Version Path
jira_issues-0.0.7 lib/jira_issues/jira_issues_navigator.rb
jira_issues-0.0.6 lib/jira_issues/jira_issues_navigator.rb