lib/rabbit/formatter.rb in rabbit-0.9.3 vs lib/rabbit/formatter.rb in rabbit-1.0.0
- old
+ new
@@ -97,30 +97,29 @@
def initialize(value)
value = value.ceil if value.is_a?(Numeric)
super(value)
end
end
-
+
class Foreground
def normalize_attribute(name, value)
value = Renderer::Color.parse(value).to_gdk_format
super(name, value)
end
end
module ConvenienceTextFormatter
-
include Formatter
def text_formatter?
true
end
-
+
def html_formatter?
true
end
-
+
def format(text)
tagged_text(text, name, {})
end
def html_format(text)
@@ -130,14 +129,35 @@
%w(b big i s sub sup small tt u).each do |name|
module_eval(<<-EOC)
class #{to_class_name(name)}
include ConvenienceTextFormatter
-
+
def name
#{name.dump}
end
end
-EOC
+ EOC
+ end
+
+ module ValueContainerFormatter
+ include Formatter
+
+ attr_reader :value
+ def initialize(value)
+ @value = value
+ end
+ end
+
+ %w(shadow-color shadow-x shadow-y).each do |name|
+ module_eval(<<-EOC)
+ class #{to_class_name(name)}
+ include ValueContainerFormatter
+
+ def name
+ #{name.dump}
+ end
+ end
+ EOC
end
end
end