Module: Travis::CLI::Gh::Subcommands
- Defined in:
- lib/travis/cli/gh/subcommands.rb
Defined Under Namespace
Modules: CommandMixin
Instance Method Summary collapse
Instance Method Details
#command(name) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/travis/cli/gh/subcommands.rb', line 14 def command(name) if name =~ /^gh-(.+)$/ const_name = command_name($1) constant = Gh.const_get(const_name) if const_name =~ /^[A-Z][a-z]+$/ and Gh.const_defined? const_name constant.extend(CommandMixin) if constant end command?(constant) ? constant : super end |
#commands ⇒ Object
23 24 25 |
# File 'lib/travis/cli/gh/subcommands.rb', line 23 def commands super + gh_commands end |
#gh_commands ⇒ Object
27 28 29 |
# File 'lib/travis/cli/gh/subcommands.rb', line 27 def gh_commands Gh.constants.map { |c| Gh.const_get(c).extend(CommandMixin) }.select { |c| command? c } end |