Method: Prompt::DSLHelper.words

Defined in:
lib/prompt/dsl_helper.rb

.words(command_name, parameters) ⇒ Object

Split command into an array of Strings and Matchers



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/prompt/dsl_helper.rb', line 8

def self.words command_name, parameters
  command_name.strip.split(/\s+/).map do |word|
    if word[0] == ":"
      param = find_param word, parameters
      SimpleMatcher.new param
    elsif word[0] == "*"
      param = find_param word, parameters
      MultiMatcher.new param
    else
      word
    end
  end
end