Class: Cyclotone::MiniNotation::AST::Elongate

Inherits:
Node
  • Object
show all
Defined in:
lib/cyclotone/mini_notation/ast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#amountObject (readonly)

Returns the value of attribute amount.



148
149
150
# File 'lib/cyclotone/mini_notation/ast.rb', line 148

def amount
  @amount
end

#patternObject (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_hObject



161
162
163
# File 'lib/cyclotone/mini_notation/ast.rb', line 161

def to_h
  { pattern: pattern, amount: amount }
end