Module: Rudelo::Parsers::Space
- Includes:
- Parslet
- Included in:
- SetLogicParser, SetValueParser
- Defined in:
- lib/rudelo/parsers/set_value_parser.rb
Instance Method Summary collapse
Instance Method Details
#spaced_op(s) ⇒ Object
10 11 12 |
# 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) ⇒ Boolean
13 14 15 16 17 18 19 20 21 22 |
# 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 |