Module: Musicality::Parseable::ClassMethods

Defined in:
lib/musicality/notation/parsing/parseable.rb

Instance Method Summary collapse

Instance Method Details

#convert(node) ⇒ Object



16
17
18
# File 'lib/musicality/notation/parsing/parseable.rb', line 16

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

#parse(str) ⇒ Object



20
21
22
# File 'lib/musicality/notation/parsing/parseable.rb', line 20

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

#parserObject



12
13
14
# File 'lib/musicality/notation/parsing/parseable.rb', line 12

def parser
  self.const_get(:PARSER)
end

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



24
25
26
# File 'lib/musicality/notation/parsing/parseable.rb', line 24

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