Class: JSGF::Rule

Inherits:
Array
  • Object
show all
Defined in:
lib/jsgf/rule.rb

Class Method Summary collapse

Class Method Details

.parse_atom(atom) ⇒ Object

Convert a string containing a single atom into an Atom or a rule reference



5
6
7
8
9
10
11
# File 'lib/jsgf/rule.rb', line 5

def self.parse_atom(atom)
    case atom
  when /\<(.*)\>/, /:(.*)/ then {name:$1, weight:1.0, tags:[]}
  else
      Atom.new(atom)
    end
end