Module: SlackTrello::SlackHelpers::TextParser
- Included in:
- Commands::CopyCards, Commands::CreateCard, Commands::Retro
- Defined in:
- lib/slack_trello/slack_helpers/text_parser.rb
Instance Method Summary collapse
- #args ⇒ Object
- #matched_text ⇒ Object
- #num_args ⇒ Object
- #regex ⇒ Object
- #text ⇒ Object
- #text_message ⇒ Object
- #valid_text_format? ⇒ Boolean
Instance Method Details
#args ⇒ Object
3 4 5 6 |
# File 'lib/slack_trello/slack_helpers/text_parser.rb', line 3 def args return "" unless valid_text_format? matched_text[1].strip.split(" ") end |
#matched_text ⇒ Object
25 26 27 |
# File 'lib/slack_trello/slack_helpers/text_parser.rb', line 25 def matched_text text.match(regex) end |
#num_args ⇒ Object
17 18 19 |
# File 'lib/slack_trello/slack_helpers/text_parser.rb', line 17 def num_args args.length end |
#regex ⇒ Object
21 22 23 |
# File 'lib/slack_trello/slack_helpers/text_parser.rb', line 21 def regex /\((.+?)\)(.+)?/ end |
#text ⇒ Object
29 30 31 |
# File 'lib/slack_trello/slack_helpers/text_parser.rb', line 29 def text slack_post_response.text end |
#text_message ⇒ Object
8 9 10 11 |
# File 'lib/slack_trello/slack_helpers/text_parser.rb', line 8 def return "" unless valid_text_format? matched_text[2].strip end |
#valid_text_format? ⇒ Boolean
13 14 15 |
# File 'lib/slack_trello/slack_helpers/text_parser.rb', line 13 def valid_text_format? !!matched_text end |