Class: Checkoff::ProjectSelectors
- Inherits:
-
Object
- Object
- Checkoff::ProjectSelectors
- Defined in:
- lib/checkoff/project_selectors.rb
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
Class Method Summary collapse
Instance Method Summary collapse
- #filter_via_project_selector(project, project_selector) ⇒ Boolean
-
#initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), workspaces: Checkoff::Workspaces.new(config: config), projects: Checkoff::Projects.new(config: config), custom_fields: Checkoff::CustomFields.new(config: config), clients: Checkoff::Clients.new(config: config), client: clients.client) ⇒ ProjectSelectors
constructor
A new instance of ProjectSelectors.
Constructor Details
#initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), workspaces: Checkoff::Workspaces.new(config: config), projects: Checkoff::Projects.new(config: config), custom_fields: Checkoff::CustomFields.new(config: config), clients: Checkoff::Clients.new(config: config), client: clients.client) ⇒ ProjectSelectors
Returns a new instance of ProjectSelectors.
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/checkoff/project_selectors.rb', line 28 def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), workspaces: Checkoff::Workspaces.new(config: config), projects: Checkoff::Projects.new(config: config), custom_fields: Checkoff::CustomFields.new(config: config), clients: Checkoff::Clients.new(config: config), client: clients.client) @workspaces = workspaces @projects = projects @custom_fields = custom_fields @client = client end |
Class Method Details
.run ⇒ void
This method returns an undefined value.
67 68 69 70 71 72 73 |
# File 'lib/checkoff/project_selectors.rb', line 67 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
44 45 46 47 |
# File 'lib/checkoff/project_selectors.rb', line 44 def filter_via_project_selector(project, project_selector) evaluator = ProjectSelectorEvaluator.new(project: project, projects: projects, custom_fields: custom_fields) evaluator.evaluate(project_selector) end |