Module: Taskit::Filters
- Included in:
- Tasks
- Defined in:
- lib/taskit/filters.rb
Overview
Define filters for selecting issues
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
29
30
31
32
33
34
|
# File 'lib/taskit/filters.rb', line 29
def method_missing(method, *args, &block)
var = parse_var method
return super unless var && @issues.first.respond_to?(var)
define_singleton_method(method) { |x| select { |i| i.send(var).match x } }
send(method, *args, &block)
end
|
Instance Method Details
#by_label(input) ⇒ Object
12
13
14
|
# File 'lib/taskit/filters.rb', line 12
def by_label(input)
select { |issue| issue.labels.any? { |label| label.name.match input } }
end
|
#respond_to?(method, include_private = false) ⇒ Boolean
16
17
18
19
20
|
# File 'lib/taskit/filters.rb', line 16
def respond_to?(method, include_private = false)
var = parse_var method
return true if var && @issues.first.respond_to?(var)
super
end
|
#select(&block) ⇒ Object
5
6
7
8
9
10
|
# File 'lib/taskit/filters.rb', line 5
def select(&block)
Taskit::Tasks.new(
client: @client,
issues: @issues.select(&block)
)
end
|