lib/rant/rantvar.rb in rant-0.4.0 vs lib/rant/rantvar.rb in rant-0.4.2

- old
+ new

@@ -14,11 +14,11 @@ # thus it acts as a namespace. # # If you're looking for general info about Rant, read the # README[link:files/README.html]. module Rant - VERSION = '0.4.0' + VERSION = '0.4.2' # Those are the filenames for rantfiles. # Case matters! RANTFILES = [ "Rantfile", "rantfile", @@ -257,11 +257,11 @@ end end # Use ENV instead of internal store for given vars. # Probably useful for vars like CC, CFLAGS, etc. - def env *vars + def env(*vars) vars.flatten.each { |var| vid = RantVar.valid_vid(var) cur_val = @store[vid] next if cur_val == @@env_ref ENV[vid] = cur_val unless cur_val.nil? @@ -358,23 +358,10 @@ def filter(val) val.to_s end end - class ::Range - def rant_constraint - case first - when ::Integer - IntegerInRange.new(self) - when ::Float - FloatInRange.new(self) - else - raise NotAConstraintFactoryError.new(self) - end - end - end - class Integer include Constraint class << self def rant_constraint(range = nil) @@ -597,5 +584,18 @@ end module_function :valid_constraint?, :valid_vid end # module RantVar end # module Rant + +class Range + def rant_constraint + case first + when ::Integer + Rant::RantVar::Constraints::IntegerInRange.new(self) + when ::Float + Rant::RantVar::Constraints::FloatInRange.new(self) + else + raise NotAConstraintFactoryError.new(self) + end + end +end