Class: PhonyTarget

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(str) ⇒ PhonyTarget

Returns a new instance of PhonyTarget.



93
94
95
96
97
98
99
100
# File 'lib/ruby_make_script/target.rb', line 93

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

    @doc = $targetdoc
    $targetdoc = TargetDoc.new
end

Instance Attribute Details

#dependObject

Returns the value of attribute depend.



80
81
82
# File 'lib/ruby_make_script/target.rb', line 80

def depend
  @depend
end

#docObject

Returns the value of attribute doc.



81
82
83
# File 'lib/ruby_make_script/target.rb', line 81

def doc
  @doc
end

#targetObject

Returns the value of attribute target.



79
80
81
# File 'lib/ruby_make_script/target.rb', line 79

def target
  @target
end

Instance Method Details

#addObject



111
112
113
114
# File 'lib/ruby_make_script/target.rb', line 111

def add
    $targetlist += [self]
    $file_target_dict[@target] = self
end

#from(*dependlist) ⇒ Object



102
103
104
105
106
107
108
109
110
# File 'lib/ruby_make_script/target.rb', line 102

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

#resolve_allObject



82
83
84
# File 'lib/ruby_make_script/target.rb', line 82

def resolve_all
    resolve(@target)
end

#runObject



86
87
88
89
90
91
92
# File 'lib/ruby_make_script/target.rb', line 86

def run
    if ! @completed
        @update_proc.call
        @completed = true
        file_modified!(@target)
    end
end