Sha256: 4708b7f3e6a0950dfa8b296bca7b10d702d6cdc556ef1f82f4d54cd7eaa4c24c
Contents?: true
Size: 453 Bytes
Versions: 75
Compression:
Stored size: 453 Bytes
Contents
require 'citrus' class Object # A sugar method for creating Citrus grammars from any namespace. # # grammar :Calc do # end # # module MyModule # grammar :Calc do # end # end # def grammar(name, &block) namespace = respond_to?(:const_set) ? self : Object namespace.const_set(name, Citrus::Grammar.new(&block)) rescue NameError raise ArgumentError, "Invalid grammar name: #{name}" end end
Version data entries
75 entries across 75 versions & 2 rubygems