From 265f30d9e827d7cfb8721c315c284de52e7395e5 Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Tue, 4 Dec 2012 09:54:31 +0900 Subject: Added unsigned_int and float attr_accessor helpers These need to be added to existing classes to replace all the repeated accessor method validation. --- lib/axlsx/util/accessors.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/axlsx/util/accessors.rb b/lib/axlsx/util/accessors.rb index f578be26..a33fdccc 100644 --- a/lib/axlsx/util/accessors.rb +++ b/lib/axlsx/util/accessors.rb @@ -22,6 +22,21 @@ module Axlsx validated_attr_accessor(symbols, 'validate_string') end + + # Creates one or more usigned integer attr_accessors + # @param [Array] symbols An array of symbols representing the + # names of the attributes you will add to your class + def unsigned_int_attr_accessor(*symbols) + validated_attr_accessor(symbols, 'validate_unsigned_int') + end + + # Creates one or more float (double?) attr_accessors + # @param [Array] symbols An array of symbols representing the + # names of the attributes you will add to your class + def float_attr_accessor(*symbols) + validated_attr_accessor(symbols, 'validate_float') + end + # Creates on or more boolean validated attr_accessors # @param [Array] symbols An array of symbols representing the # names of the attributes you will add to your class. -- cgit v1.2.3