Class: Checkoff::ProjectSelectors
- Inherits:
-
Object
- Object
- Checkoff::ProjectSelectors
- Defined in:
- lib/checkoff/project_selectors.rb,
sig/checkoff.rbs
Overview
Filter lists of projects using declarative selectors.
Constant Summary collapse
- MINUTE =
60- HOUR =
MINUTE * 60
- DAY =
24 * HOUR
- REALLY_LONG_CACHE_TIME =
HOUR * 1
- LONG_CACHE_TIME =
MINUTE * 15
- SHORT_CACHE_TIME =
MINUTE
Instance Attribute Summary collapse
-
#client ⇒ Asana::Client
readonly
sord warn - Asana::Client wasn't able to be resolved to a constant in this project.
- #custom_fields ⇒ Checkoff::CustomFields readonly
- #portfolios ⇒ Checkoff::Portfolios readonly
- #projects ⇒ Checkoff::Projects readonly
- #workspaces ⇒ Checkoff::Workspaces readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#filter_via_project_selector(project, project_selector) ⇒ Boolean
sord warn - Asana::Resources::Project wasn't able to be resolved to a constant in this project @param
project. -
#initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), workspaces: Checkoff::Workspaces.new(config:), projects: Checkoff::Projects.new(config:), custom_fields: Checkoff::CustomFields.new(config:), portfolios: Checkoff::Portfolios.new(config:), clients: Checkoff::Clients.new(config:), client: clients.client) ⇒ Object
constructor
sord warn - Asana::Client wasn't able to be resolved to a constant in this project @param
config.
Constructor Details
#initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), workspaces: Checkoff::Workspaces.new(config:), projects: Checkoff::Projects.new(config:), custom_fields: Checkoff::CustomFields.new(config:), portfolios: Checkoff::Portfolios.new(config:), clients: Checkoff::Clients.new(config:), client: clients.client) ⇒ Object
sord warn - Asana::Client wasn't able to be resolved to a constant in this project
@param config
@param workspaces
@param projects
@param custom_fields
@param portfolios
@param clients
@param client
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/checkoff/project_selectors.rb', line 30 def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), workspaces: Checkoff::Workspaces.new(config:), projects: Checkoff::Projects.new(config:), custom_fields: Checkoff::CustomFields.new(config:), portfolios: Checkoff::Portfolios.new(config:), clients: Checkoff::Clients.new(config:), client: clients.client) @workspaces = workspaces @projects = projects @custom_fields = custom_fields @portfolios = portfolios @client = client end |
Instance Attribute Details
#client ⇒ Asana::Client (readonly)
sord warn - Asana::Client wasn't able to be resolved to a constant in this project
69 70 71 |
# File 'lib/checkoff/project_selectors.rb', line 69 def client @client end |
#custom_fields ⇒ Checkoff::CustomFields (readonly)
63 64 65 |
# File 'lib/checkoff/project_selectors.rb', line 63 def custom_fields @custom_fields end |
#portfolios ⇒ Checkoff::Portfolios (readonly)
66 67 68 |
# File 'lib/checkoff/project_selectors.rb', line 66 def portfolios @portfolios end |
#projects ⇒ Checkoff::Projects (readonly)
60 61 62 |
# File 'lib/checkoff/project_selectors.rb', line 60 def projects @projects end |
#workspaces ⇒ Checkoff::Workspaces (readonly)
57 58 59 |
# File 'lib/checkoff/project_selectors.rb', line 57 def workspaces @workspaces end |
Class Method Details
.run ⇒ void
This method returns an undefined value.
75 76 77 78 79 80 81 |
# File 'lib/checkoff/project_selectors.rb', line 75 def run # workspace_name = ARGV[0] || raise('Please pass workspace name as first argument') # project_selector_name = ARGV[1] || raise('Please pass project_selector name as second argument') # project_selectors = Checkoff::ProjectSelectors.new # project_selector = project_selectors.project_selector_or_raise(workspace_name, project_selector_name) # puts "Results: #{project_selector}" end |
Instance Method Details
#filter_via_project_selector(project, project_selector) ⇒ Boolean
sord warn - Asana::Resources::Project wasn't able to be resolved to a constant in this project
@param project
@param project_selector — Filter based on project details. Examples: [:tag, 'foo'] [:not, [:tag, 'foo']] [:tag, 'foo']
48 49 50 51 52 |
# File 'lib/checkoff/project_selectors.rb', line 48 def filter_via_project_selector(project, project_selector) evaluator = ProjectSelectorEvaluator.new(project:, projects:, custom_fields:, workspaces:, portfolios:) !!evaluator.evaluate(project_selector) end |