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
- #handle_error(error) ⇒ 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
36 37 |
# File 'lib/github_cli/dsl.rb', line 36 def before(&block) end |
#configure(&block) ⇒ Object
39 40 |
# File 'lib/github_cli/dsl.rb', line 39 def configure(&block) end |
#handle_error(error) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/github_cli/dsl.rb', line 25 def handle_error(error) case error when Github::Error::NotFound terminal.newline ui.error 'Resource Not Found' terminal.newline else raise GithubCLI::GithubCLIError, "Rescued: #{error}" end end |
#on_error ⇒ Object
Defines behaviour on error to emit consistent type.
19 20 21 22 23 |
# File 'lib/github_cli/dsl.rb', line 19 def on_error yield rescue Exception => error handle_error(error) 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 |