Module: ZHRB
- Defined in:
- lib/zhrb.rb
Class Method Summary collapse
Class Method Details
.compile(code) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/zhrb.rb', line 9 def compile code code.scan(/類\s+(\S+)/m).each do |matched| matched = matched.first code.gsub!(/(\s)(#{matched}[\.\s])/, '\1C\2') end @mapping ||= YAML.load(File.read(File.join(__dir__, 'mapping.yml'))) @mapping.each{|key, value| code.gsub!(key, value) } code end |
.eval(code) ⇒ Object
5 6 7 |
# File 'lib/zhrb.rb', line 5 def eval code super compile(code) end |