Class: Juicy::Mode

Inherits:
Object
  • Object
show all
Defined in:
lib/juicy/mode.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type = :ionian) ⇒ Mode

Returns a new instance of Mode.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/juicy/mode.rb', line 10

def initialize(type = :ionian)
  @type = type
  @rotate = case @type
  when :major
  0
  when :minor
    -2
  else
    0
  end
end

Instance Attribute Details

#rotateObject (readonly)

Returns the value of attribute rotate.



8
9
10
# File 'lib/juicy/mode.rb', line 8

def rotate
  @rotate
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/juicy/mode.rb', line 8

def type
  @type
end

Instance Method Details

#==(other_mode) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/juicy/mode.rb', line 26

def ==(other_mode)
  if other_mode.kind_of? Mode
    type == other_mode.type
  elsif other_mode.kind_of? Symbol
    type == other_mode
  end
end

#to_sObject



22
23
24
# File 'lib/juicy/mode.rb', line 22

def to_s
  "#{@type}"
end