Module: Music::Transcription::Parseable::ClassMethods

Defined in:
lib/music-transcription/parsing/parseable.rb

Instance Method Summary collapse

Instance Method Details

#convert(node) ⇒ Object



17
18
19
# File 'lib/music-transcription/parsing/parseable.rb', line 17

def convert node
  node.send(self.const_get(:CONVERSION_METHOD))
end

#parse(str) ⇒ Object



21
22
23
# File 'lib/music-transcription/parsing/parseable.rb', line 21

def parse str
  convert(parser.parse(str))
end

#parserObject



13
14
15
# File 'lib/music-transcription/parsing/parseable.rb', line 13

def parser
  self.const_get(:PARSER)
end

#split_parse(str, pattern = " ") ⇒ Object



25
26
27
# File 'lib/music-transcription/parsing/parseable.rb', line 25

def split_parse str, pattern=" "
  str.split(pattern).map {|x| convert(parser.parse(x)) }
end