Class: Checkoff::SectionSelectors
- Inherits:
-
Object
- Object
- Checkoff::SectionSelectors
- Defined in:
- lib/checkoff/section_selectors.rb,
sig/checkoff.rbs
Overview
Filter lists of sections 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
- #sections ⇒ Checkoff::Sections readonly
- #workspaces ⇒ Checkoff::Workspaces readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#filter_via_section_selector(section, section_selector) ⇒ Boolean
sord warn - Asana::Resources::Section wasn't able to be resolved to a constant in this project @param
section. -
#initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), workspaces: Checkoff::Workspaces.new(config:), sections: Checkoff::Sections.new(config:), custom_fields: Checkoff::CustomFields.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:), sections: Checkoff::Sections.new(config:), custom_fields: Checkoff::CustomFields.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 sections
@param custom_fields
@param clients
@param client
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/checkoff/section_selectors.rb', line 29 def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), workspaces: Checkoff::Workspaces.new(config:), sections: Checkoff::Sections.new(config:), custom_fields: Checkoff::CustomFields.new(config:), clients: Checkoff::Clients.new(config:), client: clients.client) @workspaces = workspaces @sections = sections @custom_fields = custom_fields @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
63 64 65 |
# File 'lib/checkoff/section_selectors.rb', line 63 def client @client end |
#custom_fields ⇒ Checkoff::CustomFields (readonly)
60 61 62 |
# File 'lib/checkoff/section_selectors.rb', line 60 def custom_fields @custom_fields end |
#sections ⇒ Checkoff::Sections (readonly)
57 58 59 |
# File 'lib/checkoff/section_selectors.rb', line 57 def sections @sections end |
#workspaces ⇒ Checkoff::Workspaces (readonly)
54 55 56 |
# File 'lib/checkoff/section_selectors.rb', line 54 def workspaces @workspaces end |
Class Method Details
.run ⇒ void
This method returns an undefined value.
69 70 71 72 73 74 75 |
# File 'lib/checkoff/section_selectors.rb', line 69 def run # workspace_name = ARGV[0] || raise('Please pass workspace name as first argument') # section_selector_name = ARGV[1] || raise('Please pass section_selector name as second argument') # section_selectors = Checkoff::SectionSelectors.new # section_selector = section_selectors.section_selector_or_raise(workspace_name, section_selector_name) # puts "Results: #{section_selector}" end |
Instance Method Details
#filter_via_section_selector(section, section_selector) ⇒ Boolean
sord warn - Asana::Resources::Section wasn't able to be resolved to a constant in this project
@param section
@param section_selector — Filter based on section details. Examples: [:tag, 'foo'] [:not, [:tag, 'foo']] [:tag, 'foo']
45 46 47 48 49 |
# File 'lib/checkoff/section_selectors.rb', line 45 def filter_via_section_selector(section, section_selector) evaluator = SectionSelectorEvaluator.new(section:, sections:, custom_fields:, client:) !!evaluator.evaluate(section_selector) end |