10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/dryml-firemarker.rb', line 10
def self.metadata_to_json(template_path, kind, name, line, *args)
keys = [ ] metadata = { }
metadata[kind] = name
keys.push(kind)
path = Pathname.new(template_path).realpath.to_s
writeable = path.match(/^#{Regexp.quote(rails_root)}\//) &&
( auto_path.blank? ||! path.match(/^#{Regexp.quote(auto_path)}\//) )
path.gsub!(%r{/}, '\\\\\\\\') if WINDOZE unless args.empty?
metadata['args'] = args.join(' | ')
keys.push('args')
end
metadata['path'] = path + ':' + line.to_s + (writeable ? '+' : '')
keys.push('path')
"{#{ keys.map{|k| k.inspect + ':' + metadata[k].inspect}.join(',') }}"
end
|