lib/danica/common.rb in danica-2.7.1 vs lib/danica/common.rb in danica-2.7.2
- old
+ new
@@ -2,27 +2,27 @@
module Common extend ::ActiveSupport::Concern
included do
include Wrapper
include DSL
- class << self
- def default_value(name, value)
- define_method(name) { |*_| value }
- end
-
- def default_values(*names, value)
- names.each do |name|
- default_value(name, value)
- end
- end
- end
-
default_values :constant?, :signaled?, :container?, :variable?,
:variable_holder?, false
default_value :priority, 1
end
+ class_methods do
+ def default_value(name, value)
+ define_method(name) { |*_| value }
+ end
+
+ def default_values(*names, value)
+ names.each do |name|
+ default_value(name, value)
+ end
+ end
+ end
+
def to_f
raise Exception::NotImplemented
end
def to_tex(**options)
@@ -45,14 +45,18 @@
raise Exception::FormattedNotFound.new
end
end
def tex(**options)
- Formatted.new(self, :tex, options)
+ formatted(:tex, options)
end
def gnu(**options)
- Formatted.new(self, :gnu, options)
+ formatted(:gnu, options)
+ end
+
+ def formatted(*args)
+ Formatted.new(self, *args)
end
def valued?
to_f.present?
rescue Exception::NotDefined