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.70 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.69 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.68 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.67 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.66 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.65 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.64 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.63 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.62 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.61 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.60 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.59 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.58 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.57 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.56 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.55 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.54 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.53 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.52 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb
harbr-0.1.50 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/lib/citrus/core_ext.rb