Module: Jzip::Core::String::Analyzation

Included in:
String
Defined in:
lib/jzip/core/string/analyzation.rb

Instance Method Summary collapse

Instance Method Details

#jzip_require_statement?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/jzip/core/string/analyzation.rb', line 7

def jzip_require_statement?
  !!self.strip.match(Jzip::Engine::REG_EXPS[:require_statement])
end

#overrule_jzip_minification?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/jzip/core/string/analyzation.rb', line 15

def overrule_jzip_minification?
  !!required_jzip_source(false).match(/^!/) if self.jzip_require_statement?
end

#required_jzip_source(exclude_exclamation_mark = true) ⇒ Object



11
12
13
# File 'lib/jzip/core/string/analyzation.rb', line 11

def required_jzip_source(exclude_exclamation_mark = true)
  self.strip.gsub(Regexp.new([Jzip::Engine::REG_EXPS[:require_statement].source, ("\!?" if exclude_exclamation_mark)].compact.join), "").strip if self.jzip_require_statement?
end