Class: Cyclotone::MiniNotation::AST::Elongate
- Defined in:
- lib/cyclotone/mini_notation/ast.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Instance Method Summary collapse
- #increment(step = 1) ⇒ Object
-
#initialize(pattern:, amount:) ⇒ Elongate
constructor
A new instance of Elongate.
- #to_h ⇒ Object
Methods inherited from Node
#==, deep_freeze, #hash, #to_mn
Constructor Details
#initialize(pattern:, amount:) ⇒ Elongate
Returns a new instance of Elongate.
150 151 152 153 154 155 |
# File 'lib/cyclotone/mini_notation/ast.rb', line 150 def initialize(pattern:, amount:) super() @pattern = pattern @amount = amount freeze end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
148 149 150 |
# File 'lib/cyclotone/mini_notation/ast.rb', line 148 def amount @amount end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
148 149 150 |
# File 'lib/cyclotone/mini_notation/ast.rb', line 148 def pattern @pattern end |
Instance Method Details
#increment(step = 1) ⇒ Object
157 158 159 |
# File 'lib/cyclotone/mini_notation/ast.rb', line 157 def increment(step = 1) self.class.new(pattern: pattern, amount: amount + step) end |
#to_h ⇒ Object
161 162 163 |
# File 'lib/cyclotone/mini_notation/ast.rb', line 161 def to_h { pattern: pattern, amount: amount } end |