Module: GithubCLI::DSL
- Included in:
- GithubCLI
- Defined in:
- lib/github_cli/dsl.rb
Constant Summary collapse
- @@program_name =
$0.split(/\//)[-1]
- @@error_block =
nil
Instance Method Summary collapse
- #before(&block) ⇒ Object
- #configure(&block) ⇒ Object
-
#on_error ⇒ Object
Defines behaviour on error to emit consistent type.
-
#program_name(name = nil) ⇒ Object
Defines a program name.
Instance Method Details
#before(&block) ⇒ Object
32 33 |
# File 'lib/github_cli/dsl.rb', line 32 def before(&block) end |
#configure(&block) ⇒ Object
35 36 |
# File 'lib/github_cli/dsl.rb', line 35 def configure(&block) end |
#on_error ⇒ Object
Defines behaviour on error to emit consistent type.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/github_cli/dsl.rb', line 19 def on_error yield rescue Exception => error case error when Github::Error::NotFound terminal.newline ui.error 'Resource Not Found' terminal.newline else raise GithubCLI::GithubCLIError, "Rescued: #{error}" end end |
#program_name(name = nil) ⇒ Object
Defines a program name.
10 11 12 13 14 15 |
# File 'lib/github_cli/dsl.rb', line 10 def program_name(name=nil) if name @@program_name = name end @@program_name end |