remove module monkey-patching; add Builder#name()
This commit is contained in:
parent
08bc390d40
commit
cdb3352b4e
@ -4,7 +4,6 @@ require "rscons/environment"
|
|||||||
require "rscons/varset"
|
require "rscons/varset"
|
||||||
require "rscons/version"
|
require "rscons/version"
|
||||||
|
|
||||||
require "rscons/monkey/module"
|
|
||||||
require "rscons/monkey/string"
|
require "rscons/monkey/string"
|
||||||
|
|
||||||
# default builders
|
# default builders
|
||||||
|
@ -3,6 +3,12 @@ require "fileutils"
|
|||||||
module Rscons
|
module Rscons
|
||||||
# Class to hold an object that knows how to build a certain type of file.
|
# Class to hold an object that knows how to build a certain type of file.
|
||||||
class Builder
|
class Builder
|
||||||
|
# Return the name of the builder.
|
||||||
|
# If not overridden this defaults to the last component of the class name.
|
||||||
|
def name
|
||||||
|
self.class.name.split(":").last
|
||||||
|
end
|
||||||
|
|
||||||
# Return a set of default variable values for the Environment to use
|
# Return a set of default variable values for the Environment to use
|
||||||
# unless the user overrides any.
|
# unless the user overrides any.
|
||||||
# @param env [Environment] The Environment.
|
# @param env [Environment] The Environment.
|
||||||
|
@ -76,7 +76,7 @@ module Rscons
|
|||||||
|
|
||||||
# Add a {Builder} object to the Environment.
|
# Add a {Builder} object to the Environment.
|
||||||
def add_builder(builder)
|
def add_builder(builder)
|
||||||
@builders[builder.class.short_name] = builder
|
@builders[builder.name] = builder
|
||||||
var_defs = builder.default_variables(self)
|
var_defs = builder.default_variables(self)
|
||||||
if var_defs
|
if var_defs
|
||||||
var_defs.each_pair do |var, val|
|
var_defs.each_pair do |var, val|
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
# Standard Ruby Module class.
|
|
||||||
class Module
|
|
||||||
# @return the base module name (not the fully qualified name)
|
|
||||||
def short_name
|
|
||||||
name.split(':').last
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,6 +0,0 @@
|
|||||||
describe "Module#short_name" do
|
|
||||||
it "returns the inner name of the module" do
|
|
||||||
Rscons::Environment.short_name.should == "Environment"
|
|
||||||
Rscons::Object.short_name.should == "Object"
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
x
Reference in New Issue
Block a user