Class: Juicy::Mode
- Inherits:
-
Object
- Object
- Juicy::Mode
- Defined in:
- lib/juicy/mode.rb
Instance Attribute Summary collapse
-
#rotate ⇒ Object
readonly
Returns the value of attribute rotate.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other_mode) ⇒ Object
-
#initialize(type = :ionian) ⇒ Mode
constructor
A new instance of Mode.
- #to_s ⇒ Object
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
#rotate ⇒ Object (readonly)
Returns the value of attribute rotate.
8 9 10 |
# File 'lib/juicy/mode.rb', line 8 def rotate @rotate end |
#type ⇒ Object (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_s ⇒ Object
22 23 24 |
# File 'lib/juicy/mode.rb', line 22 def to_s "#{@type}" end |