grape

https://github.com/intridea/grape

Ruby

An opinionated framework for creating REST-like APIs in Ruby.

Gitlab::QuickActions::Extractor#extract_commands

Extracts commands from content and return an array of commands.
The array looks like the following:
[
  ['command1'],
  ['command3', 'arg1 arg2'],
]
The command and the arguments are stripped.
The original command text is removed from the given `content`.

Usage:
```
extractor = Gitlab::QuickActions::Extractor.new([:open, :assign, :labels])
msg = %(hello\n/labels ~foo ~"bar baz"\nworld)
commands = extractor.extract_commands(msg) #=> [['labels', '~foo ~"bar baz"']]
msg #=> "hello\nworld"
```

Source | Google | Stack overflow

Edit

git clone [email protected]:intridea/grape.git

cd grape

open

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Gitlab--QuickActions--Extractor-extract_commands-for-pr


# Commit to git

git add git commit -m "better docs for Gitlab::QuickActions::Extractor#extract_commands"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Gitlab--QuickActions--Extractor-extract_commands-for-pr

hub pull-request


# Celebrate!