lib/danica/common.rb in danica-2.2.1 vs lib/danica/common.rb in danica-2.3.0
- old
+ new
@@ -1,8 +1,10 @@
module Danica
module Common extend ::ActiveSupport::Concern
included do
+ include DSL
+
class << self
def default_value(name, value)
define_method(name) { value }
end
end
@@ -19,18 +21,18 @@
end
private
def wrap_value(value)
- return wrap_value(Number.new(value)) if value.is_a?(Numeric)
- return wrap_value(Variable.new(value)) if value.is_a?(Hash)
- return wrap_value(Variable.new(name: value)) if [ String, Symbol ].any? { |c| value.is_a?(c) }
- return wrap_value(Variable.new) if value.nil?
+ return wrap_value(number(value)) if value.is_a?(Numeric)
+ return wrap_value(variable(value)) if value.is_a?(Hash)
+ return wrap_value(variable(name: value)) if [ String, Symbol ].any? { |c| value.is_a?(c) }
+ return wrap_value(variable) if value.nil?
value
end
def wrap_as_group(value)
return value if is_grouped? || value.priority >= priority
- Group.new(value)
+ group(value)
end
end
end