Module: ANTLR3::Test::DependantFile

Included in:
Grammar
Defined in:
lib/antlr3/test/grammar.rb

Constant Summary collapse

GLOBAL_DEPENDENCIES =
[]

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#forceObject Also known as: force?

Returns the value of attribute force.



12
13
14
# File 'lib/antlr3/test/grammar.rb', line 12

def force
  @force
end

#pathObject

Returns the value of attribute path.



12
13
14
# File 'lib/antlr3/test/grammar.rb', line 12

def path
  @path
end

Instance Method Details

#dependenciesObject



17
18
19
# File 'lib/antlr3/test/grammar.rb', line 17

def dependencies
  @dependencies ||= GLOBAL_DEPENDENCIES.clone
end

#depends_on(path) ⇒ Object



21
22
23
24
25
# File 'lib/antlr3/test/grammar.rb', line 21

def depends_on( path )
  path = File.expand_path path.to_s
  dependencies << path if test( ?f, path )
  return path
end

#stale?Boolean

Returns:

  • (Boolean)


27
28
29
30
31
32
33
# File 'lib/antlr3/test/grammar.rb', line 27

def stale?
  force and return( true )
  target_files.any? do |target|
    not test( ?f, target ) or
      dependencies.any? { |dep| test( ?>, dep, target ) }
  end
end