Class: Ninja::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/ninja.rb

Instance Method Summary collapse

Constructor Details

#initialize(rule_desc, depfile = "") ⇒ Rule

Returns a new instance of Rule.



13
14
15
16
17
# File 'lib/ninja.rb', line 13

def initialize(rule_desc, depfile="")
  @rule_desc = rule_desc
  @depfile = depfile
  @unique_name = Ninja.create_UUID
end

Instance Method Details

#depfile_lineObject



23
24
25
26
27
28
29
# File 'lib/ninja.rb', line 23

def depfile_line
  if @depfile == ""
    ""
  else
    "  depfile = #{@depfile}\n"
  end
end

#nameObject



38
39
40
# File 'lib/ninja.rb', line 38

def name
  @unique_name
end

#to_ninja_formatObject



31
32
33
34
35
36
# File 'lib/ninja.rb', line 31

def to_ninja_format
"""
rule #{unique_name}
#{depfile_line}  command = #{@rule_desc}
"""
end

#unique_nameObject



19
20
21
# File 'lib/ninja.rb', line 19

def unique_name
  @unique_name
end