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

Instance Method Details

#argsObject



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_textObject



25
26
27
# File 'lib/slack_trello/slack_helpers/text_parser.rb', line 25

def matched_text
  text.match(regex)
end

#num_argsObject



17
18
19
# File 'lib/slack_trello/slack_helpers/text_parser.rb', line 17

def num_args
  args.length
end

#regexObject



21
22
23
# File 'lib/slack_trello/slack_helpers/text_parser.rb', line 21

def regex
  /\((.+?)\)(.+)?/
end

#textObject



29
30
31
# File 'lib/slack_trello/slack_helpers/text_parser.rb', line 29

def text
  slack_post_response.text
end

#text_messageObject



8
9
10
11
# File 'lib/slack_trello/slack_helpers/text_parser.rb', line 8

def text_message
  return "" unless valid_text_format?
  matched_text[2].strip
end

#valid_text_format?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/slack_trello/slack_helpers/text_parser.rb', line 13

def valid_text_format?
  !!matched_text
end