Skip to content

Commit

Permalink
#1 scan instead of split
Browse files Browse the repository at this point in the history
  • Loading branch information
Yegor Bugayenko committed Mar 19, 2016
1 parent c0c8ec3 commit da413a1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/xembly/directives.rb
Expand Up @@ -48,8 +48,9 @@ def length
def self.map(text)
cmd, tail = text.strip.split(/\s+/, 2)
args = tail.strip
.split(/"\s*,\s*"|'\s*,\s*'/)
.map { |a| a.tr('\'"', '') }
.scan(/"([^"]+)"/)
.flatten
.map { |a| a.tr('"', '') }
case cmd.upcase
when 'ADD'
Add.new(args[0])
Expand Down

0 comments on commit da413a1

Please sign in to comment.