module Rudelo::Parsers::Space

Public Instance Methods

spaced_op(s) click to toggle source
# File lib/rudelo/parsers/set_value_parser.rb, line 10
def spaced_op(s)
  space >> str(s).as(:op)  >> space
end
spaced_op?(s, protect=nil) click to toggle source
# File lib/rudelo/parsers/set_value_parser.rb, line 13
def spaced_op?(s, protect=nil)
  if protect
    # this is necessary when some ops are substrings of
    # other ops. if you have '>' and '>=', use
    # spaced_op?('>', '=') for '>'
    space? >> str(protect).absent? >> str(s).as(:op)  >> space? >> str(protect).absent?
  else
    space? >> str(s).as(:op)  >> space?
  end
end