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

Version Path
harbr-0.1.90 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.89 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.88 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.87 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.86 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.85 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.84 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.83 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.82 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.81 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.80 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.79 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.78 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.77 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.76 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.75 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.74 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.73 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.72 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.71 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb