4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/dramaturg/parser.rb', line 4
def call(cmd)
tokens = tokenize(cmd.to_s)
tokens.each do |t|
case t
when /^\{(\w+):(.+)\}$/
add_named_value(cmd, $1.to_sym, $2)
when /^\{([^\$].*)\}$/
add_anon_value(cmd, $1)
when /^\{(\$.+)\}/
add_var_value(cmd, $1)
else
cmd << Value::Fixed.new(t)
end
end
if cmd.allow_suffix
suffix = Value::OrDefault.new("")
cmd[:_suffix] = suffix
cmd << suffix
end
if cmd.save_to_file
cmd << Value::Silent.new(" | tee #{cmd.save_to_file}")
end
end
|