Module: GoogleChart::DataArray::ClassMethods

Defined in:
lib/google_chart/modules/data_array.rb

Instance Method Summary collapse

Instance Method Details

#data_type(type) ⇒ Object

:nodoc:

Raises:

  • (ArgumentError)


39
40
41
42
43
44
45
46
47
48
49
# File 'lib/google_chart/modules/data_array.rb', line 39

def data_type(type) #:nodoc:
  raise ArgumentError.new("Invalid data type, must be either :numeric, :numeric_array or :numeric_2d_array") unless [:numeric, :numeric_array, :numeric_2d_array].include?(type)
  # This is the *instance variable* of the *singleton class* ;)
  @data_type = type

  if @data_type == :numeric_2d_array
    attr_accessor :max_x, :max_y
  else
    attr_accessor :max
  end
end

#get_data_typeObject

:nodoc:

Raises:

  • (ArgumentError)


51
52
53
54
# File 'lib/google_chart/modules/data_array.rb', line 51

def get_data_type #:nodoc:
  raise ArgumentError.new("Data type not specified") unless @data_type
  "is_#{@data_type}?".to_sym
end