Class: Formator

Inherits:
Object
  • Object
show all
Defined in:
lib/euclidean_sequencer/formator.rb

Class Method Summary collapse

Class Method Details

.format_sequence(sequence:, options: {array: nil, offset: nil}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/euclidean_sequencer/formator.rb', line 3

def self.format_sequence(sequence:, options: {array: nil, offset: nil})
  if options[:array] && !options[:offset]
    return convert_to_array(sequence)
  end

  if options[:array] && options[:offset]
    return offset(convert_to_array(sequence), options[:offset])
  end

  if options[:offset] && !options[:array]
    return offset(sequence, options[:offset])
  end

  return sequence
end