Class: Jzip::Engine::Requirement

Inherits:
Struct
  • Object
show all
Includes:
Support::Notifier
Defined in:
lib/jzip/engine/requirement.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Support::Notifier

#notify

Instance Attribute Details

#fileObject

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file



5
6
7
# File 'lib/jzip/engine/requirement.rb', line 5

def file
  @file
end

#overrule_minificationObject

Returns the value of attribute overrule_minification

Returns:

  • (Object)

    the current value of overrule_minification



5
6
7
# File 'lib/jzip/engine/requirement.rb', line 5

def overrule_minification
  @overrule_minification
end

#sourceObject

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



5
6
7
# File 'lib/jzip/engine/requirement.rb', line 5

def source
  @source
end

#targetObject

Returns the value of attribute target

Returns:

  • (Object)

    the current value of target



5
6
7
# File 'lib/jzip/engine/requirement.rb', line 5

def target
  @target
end

Instance Method Details

#codeObject



21
22
23
# File 'lib/jzip/engine/requirement.rb', line 21

def code
  parse
end

#newer?(mtime) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
# File 'lib/jzip/engine/requirement.rb', line 9

def newer?(mtime)
  notify "Newer     '#{target_file}'" if result = mtime < File.mtime(target_file)
  result
end

#parseObject



14
15
16
17
18
19
# File 'lib/jzip/engine/requirement.rb', line 14

def parse
  @code ||= begin
              source_file = plain_javascript? ? self.file : (template.parse; template.target_file)
              File.read(minify? ? Support::Minifier.parse(source_file) : source_file)
            end
end