module Axlsx::Accessors::ClassMethods

Defines the class level xxx_attr_accessor methods

Constants

SETTER

Template for defining validated write accessors

Public Instance Methods

boolean_attr_accessor(*symbols) click to toggle source

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.

# File lib/axlsx/util/accessors.rb, line 43
def boolean_attr_accessor(*symbols)
  validated_attr_accessor(symbols, 'validate_boolean')
end
float_attr_accessor(*symbols) click to toggle source

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

# File lib/axlsx/util/accessors.rb, line 36
def float_attr_accessor(*symbols)
  validated_attr_accessor(symbols, 'validate_float')
end
string_attr_accessor(*symbols) click to toggle source

Creates one or more string validated attr_accessors @param [Array] symbols An array of symbols representing the names of the attributes you will add to your class.

# File lib/axlsx/util/accessors.rb, line 21
def string_attr_accessor(*symbols)
  validated_attr_accessor(symbols, 'validate_string')
end
unsigned_int_attr_accessor(*symbols) click to toggle source

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

# File lib/axlsx/util/accessors.rb, line 29
def unsigned_int_attr_accessor(*symbols)
  validated_attr_accessor(symbols, 'validate_unsigned_int')
end
validated_attr_accessor(symbols, validator) click to toggle source

Creates the reader and writer access methods @param [Array] symbols The names of the attributes to create @param [String] validator The axlsx validation method to use when validating assignation. @see lib/axlsx/util/validators.rb

# File lib/axlsx/util/accessors.rb, line 55
def validated_attr_accessor(symbols, validator)
  symbols.each do |symbol|
    attr_reader symbol
    module_eval(SETTER % [symbol.to_s, validator, symbol.to_s], __FILE__, __LINE__)
  end
end