Class: Abt::Providers::Asana::Path
- Inherits:
-
String
- Object
- String
- Abt::Providers::Asana::Path
- Defined in:
- lib/abt/providers/asana/path.rb
Constant Summary collapse
- PATH_REGEX =
%r{^(?<project_gid>\d+)?/?(?<task_gid>\d+)?$}.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path = "") ⇒ Path
constructor
A new instance of Path.
- #project_gid ⇒ Object
- #task_gid ⇒ Object
Constructor Details
#initialize(path = "") ⇒ Path
Returns a new instance of Path.
14 15 16 17 18 |
# File 'lib/abt/providers/asana/path.rb', line 14 def initialize(path = "") raise Abt::Cli::Abort, "Invalid path: #{path}" unless PATH_REGEX.match?(path) super end |
Class Method Details
.from_gids(project_gid: nil, task_gid: nil) ⇒ Object
9 10 11 12 |
# File 'lib/abt/providers/asana/path.rb', line 9 def self.from_gids(project_gid: nil, task_gid: nil) path = project_gid ? [project_gid, *task_gid].join("/") : "" new(path) end |
Instance Method Details
#project_gid ⇒ Object
20 21 22 |
# File 'lib/abt/providers/asana/path.rb', line 20 def project_gid match[:project_gid] end |
#task_gid ⇒ Object
24 25 26 |
# File 'lib/abt/providers/asana/path.rb', line 24 def task_gid match[:task_gid] end |