lib/weskit/wml/attribute.rb in weskit-0.3.5 vs lib/weskit/wml/attribute.rb in weskit-0.3.6

- old
+ new

@@ -35,27 +35,28 @@ self.value = value merge defaults end + def value + real_value + end + def value= object - @value = convert object + @value = object.to_s.strip + @value.attr = self end private - def convert object - string = object.to_s.strip - - object = case string - when %r{^(nil|null)$} then nil - when %r{^(true|yes)$} then true - when %r{^(false|no)$} then false - when %r{^[0-9]*\.[0-9]+$} then Float string - when %r{^[0-9]+$} then Integer string - else string + def real_value + case @value + when %r{^(nil|null)$} then nil + when %r{^(true|yes)$} then true + when %r{^(false|no)$} then false + when %r{^[0-9]*\.[0-9]+$} then Float @value + when %r{^[0-9]+$} then Integer @value + else @value end - - object.attr = self ; object end end end