Class: MoreCoreExtensions::ArrayTableize::Tableizer

Inherits:
Object
  • Object
show all
Defined in:
lib/more_core_extensions/core_ext/array/tableize.rb

Overview

This class is a private implementation and not part of the public API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target, options) ⇒ Tableizer

Returns a new instance of Tableizer.



41
42
43
44
# File 'lib/more_core_extensions/core_ext/array/tableize.rb', line 41

def initialize(target, options)
  @target = target
  @options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



39
40
41
# File 'lib/more_core_extensions/core_ext/array/tableize.rb', line 39

def options
  @options
end

#targetObject

Returns the value of attribute target.



39
40
41
# File 'lib/more_core_extensions/core_ext/array/tableize.rb', line 39

def target
  @target
end

Instance Method Details

#tableizeObject



46
47
48
49
50
51
52
# File 'lib/more_core_extensions/core_ext/array/tableize.rb', line 46

def tableize
  case target.first
  when Array then tableize_arrays
  when Hash  then tableize_hashes
  else raise "must be an Array of Arrays or Array of Hashes"
  end
end