Class: Cyclotone::MiniNotation::AST::Repeat

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:, count:) ⇒ Repeat

Returns a new instance of Repeat.



105
106
107
108
109
110
# File 'lib/cyclotone/mini_notation/ast.rb', line 105

def initialize(pattern:, count:)
  super()
  @pattern = pattern
  @count = count.to_i
  freeze
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



103
104
105
# File 'lib/cyclotone/mini_notation/ast.rb', line 103

def count
  @count
end

#patternObject (readonly)

Returns the value of attribute pattern.



103
104
105
# File 'lib/cyclotone/mini_notation/ast.rb', line 103

def pattern
  @pattern
end

Instance Method Details

#to_hObject



112
113
114
# File 'lib/cyclotone/mini_notation/ast.rb', line 112

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