Class: SellObject::Buscape::FormatterProxy

Inherits:
FormatterProxy show all
Defined in:
lib/sell_object/buscape/formatter_proxy.rb

Instance Attribute Summary

Attributes inherited from FormatterProxy

#target

Instance Method Summary collapse

Methods inherited from FormatterProxy

#initialize

Constructor Details

This class inherits a constructor from SellObject::FormatterProxy

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class SellObject::FormatterProxy

Instance Method Details

#preco(target_method) ⇒ Object

Raises:

  • (ArgumentError)


4
5
6
7
8
# File 'lib/sell_object/buscape/formatter_proxy.rb', line 4

def preco(target_method)
	target_value = target.send target_method
	raise ArgumentError, "method expects a number, got #{target_value.class.name}: #{target_value}" unless target_value.is_a? Numeric 
	('%.2f' % target_value).gsub '.', ','
end