Class: FileTarget

Inherits:
Object
  • Object
show all
Includes:
Target
Defined in:
lib/ruby_make_script/target.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Target

#depend_each, #depend_modified?

Constructor Details

#initialize(targetlist) ⇒ FileTarget

Returns a new instance of FileTarget.



54
55
56
57
58
# File 'lib/ruby_make_script/target.rb', line 54

def initialize(targetlist)
   @target = targetlist
   @depend = []
   @completed = false
end

Instance Attribute Details

#dependObject

Returns the value of attribute depend.



37
38
39
# File 'lib/ruby_make_script/target.rb', line 37

def depend
  @depend
end

Instance Method Details

#addObject



69
70
71
72
73
74
# File 'lib/ruby_make_script/target.rb', line 69

def add
    $targetlist += [self]
    @target.each { |t|
        $file_target_dict[t] = self
    }
end

#from(*dependlist) ⇒ Object



60
61
62
63
64
65
66
67
68
# File 'lib/ruby_make_script/target.rb', line 60

def from(*dependlist)
    @depend = dependlist
    @update_proc = Proc.new { 
        $t = @target
        $d = @depend
        yield
    }
    add()
end

#resolve_allObject



39
40
41
42
43
# File 'lib/ruby_make_script/target.rb', line 39

def resolve_all
    @target.each{ |f|
        resolve(f)
    }
end

#runObject



45
46
47
48
49
50
51
52
53
# File 'lib/ruby_make_script/target.rb', line 45

def run
    if ! @completed
        @update_proc.call
        @completed = true
        @target.each{ |f|
            file_modified!(f)
        }
    end
end