lib/range_dsl.rb in range_dsl-0.1.1 vs lib/range_dsl.rb in range_dsl-0.1.2
- old
+ new
@@ -29,10 +29,12 @@
alias_method :eq, :equal
alias_method :neq, :not_equal
alias_method :not_be, :invert
alias_method :nb, :invert
+ extend self
+
class << self
def include?(exp, v)
if exp.is_a?(Array)
exp.any?{|e| include?(e, v)}
elsif exp.respond_to?(:include?)
@@ -44,9 +46,17 @@
def equal_with_considering_numeric(left, right)
return true if left == right
return true if left.is_a?(Numeric) && right.is_a?(Numeric) && (left.to_f == right.to_f)
false
+ end
+
+ def compile(dsl = nil, &block)
+ if block
+ self.instance_eval(&block)
+ else
+ self.instance_eval(dsl)
+ end
end
end
end