lib/code/object/string.rb in template-ruby-0.2.3 vs lib/code/object/string.rb in template-ruby-0.2.4

- old
+ new

@@ -13,10 +13,12 @@ if operator == "to_function" to_function(arguments) elsif operator == "+" plus(arguments) + elsif operator == "*" + multiplication(arguments) elsif operator == "reverse" reverse(arguments) else super end @@ -47,9 +49,15 @@ def plus(arguments) sig(arguments, ::Code::Object::String) other = arguments.first.value ::Code::Object::String.new(raw + other.raw) + end + + def multiplication(arguments) + sig(arguments, ::Code::Object::Number) + other = arguments.first.value + ::Code::Object::String.new(raw * other.raw) end def reverse(arguments) sig(arguments) ::Code::Object::String.new(raw.reverse)