summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-12-04 09:54:31 +0900
committerRandy Morgan <[email protected]>2012-12-04 09:54:31 +0900
commit265f30d9e827d7cfb8721c315c284de52e7395e5 (patch)
tree0b0402caeb8962ea565226fe60e68cf0f76d6f67
parent979523372fb05a7c3da574759a13e82a491bf94f (diff)
downloadcaxlsx-265f30d9e827d7cfb8721c315c284de52e7395e5.tar.gz
caxlsx-265f30d9e827d7cfb8721c315c284de52e7395e5.zip
Added unsigned_int and float attr_accessor helpers
These need to be added to existing classes to replace all the repeated accessor method validation.
-rw-r--r--lib/axlsx/util/accessors.rb15
1 files changed, 15 insertions, 0 deletions
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.