Module: StairCar::InitMethods::ClassMethods

Defined in:
lib/stair_car/shared/init_methods.rb

Instance Method Summary collapse

Instance Method Details

#init_method_names {|:float, false, :float, :zeros| ... } ⇒ Object

Yields:

  • (:float, false, :float, :zeros)


30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/stair_car/shared/init_methods.rb', line 30

def init_method_names
  [true, false].each do |sparse|
    [:double, :float].each do |type|
      [:zeros, :ones, :rand, :desc, :asc].each do |initialize_values|
        method_name = :"#{sparse ? 'sp' : ''}#{initialize_values}#{type == :float ? 'f' : ''}"

        yield(method_name, sparse, type, initialize_values)
      end
    end
  end

  # Also add float and double shortcuts
  yield(:float, false, :float, :zeros)
  yield(:double, false, :float, :zeros)
end