Class: SearchLingo::Token
- Inherits:
-
String
- Object
- String
- SearchLingo::Token
- Defined in:
- lib/search_lingo/token.rb
Constant Summary collapse
- STRUCTURE =
Pattern for decomposing a token into a modifier and a term.
/\A(?:(#{MODIFIER}):[[:space:]]*)?"?(.+?)"?\z/
Instance Method Summary collapse
-
#compound? ⇒ Boolean
Returns
true
if token has a modifier andfalse
otherwise. -
#inspect ⇒ Object
:nodoc:.
-
#modifier ⇒ Object
(also: #operator)
Returns the modifier portion of the token.
-
#term ⇒ Object
Returns the term portion of the token.
Instance Method Details
#compound? ⇒ Boolean
38 39 40 |
# File 'lib/search_lingo/token.rb', line 38 def compound? !!modifier end |
#inspect ⇒ Object
:nodoc:
42 43 44 45 |
# File 'lib/search_lingo/token.rb', line 42 def inspect # :nodoc: '#<%s String(%s) modifier=%s term=%s>' % [self.class, super, modifier.inspect, term.inspect] end |
#modifier ⇒ Object Also known as: operator
16 17 18 |
# File 'lib/search_lingo/token.rb', line 16 def modifier self[STRUCTURE, 1] end |