Module: Fig::Statement::Asset::ClassMethods
- Defined in:
- lib/fig/statement/asset.rb
Instance Method Summary collapse
-
#validate_and_process_escapes_in_url!(url, &block) ⇒ Object
Modifies the parameter to deal with quoting, escaping.
Instance Method Details
#validate_and_process_escapes_in_url!(url, &block) ⇒ Object
Modifies the parameter to deal with quoting, escaping.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/fig/statement/asset.rb', line 56 def validate_and_process_escapes_in_url!(url, &block) was_in_single_quotes = Fig::Statement.strip_quotes_and_process_escapes!(url, &block) return if was_in_single_quotes.nil? if url.include? '@' yield %q<contains an "@", which isn't permitted in order to allow for package substitution.> return end if url =~ / ( ["<>|] ) /x yield %Q<contains a "#{$1}", which isn't permitted because Windows doesn't allow it in file names.> return end if url =~ / ( ' ) /x yield %Q<contains a "#{$1}", which isn't permitted to allow for future grammar expansion.> return end # "config" is a reasonable asset name, so we let that pass. if Fig::Parser.strict_keyword?(url) yield 'is a keyword.' end return ! was_in_single_quotes end |