module Faye::Grammar
Constants
- ALPHA
- ALPHANUM
- CHANNEL_NAME
- CHANNEL_PATTERN
- CHANNEL_SEGMENT
- CHANNEL_SEGMENTS
- CLIENT_ID
- DIGIT
- ERROR
- ERROR_ARGS
- ERROR_CODE
- ERROR_MESSAGE
- ID
- INTEGER
- LOWALPHA
- MARK
- STRING
- TOKEN
- UPALPHA
- VERSION
- VERSION_ELEMENT
- WILD_CARD
Public Class Methods
Source
# File lib/faye/protocol/grammar.rb, line 9 def self.choice(*list) '(' + list.map(&method(:string)) * '|' + ')' end
Source
# File lib/faye/protocol/grammar.rb, line 17 def self.oneormore(*pattern) '(' + string(pattern) + ')+' end
Source
# File lib/faye/protocol/grammar.rb, line 13 def self.repeat(*pattern) '(' + string(pattern) + ')*' end
Source
# File lib/faye/protocol/grammar.rb, line 4 def self.rule(&block) source = instance_eval(&block) %r{^#{string(source)}$} end
Source
# File lib/faye/protocol/grammar.rb, line 21 def self.string(item) return item.map(&method(:string)) * '' if Array === item String === item ? item : item.source.gsub(/^\^/, '').gsub(/\$$/, '') end