lib/handsoap/xml_query_front.rb in handsoap-1.1.8 vs lib/handsoap/xml_query_front.rb in handsoap-1.2.2

- old
+ new

@@ -84,10 +84,13 @@ self.first.to_boolean if self.any? end def to_date self.first.to_date if self.any? end + def to_big_decimal(decimal_places = 2) + self.first.to_big_decimal(decimal_places) if self.any? + end def to_s self.first.to_s if self.any? end def node_name self.first.node_name if self.any? @@ -156,9 +159,17 @@ # See +to_s+ def to_date t = self.to_s return if t.nil? Time.iso8601(t) + end + # Returns the value of the element as an instance of BigDecimal + # + # See +to_s+ + def to_big_decimal(decimal_places = 2) + t = self.to_s + return if t.nil? + BigDecimal.new t, decimal_places end # Returns the inner text content of this element, or the value (if it's an attr or textnode). # # The output is a UTF-8 encoded string, without xml-entities. def to_s