Class: EsQueryBuilder::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/es-query-builder/token.rb

Constant Summary collapse

TYPE_KINDS =
%i(query filter or).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(full: nil, minus: nil, field: nil, term: nil, type: nil) ⇒ Token

Returns a new instance of Token.



7
8
9
10
11
12
13
14
# File 'lib/es-query-builder/token.rb', line 7

def initialize(full: nil, minus: nil, field: nil, term: nil, type: nil)
  @full = full
  @minus = !!minus
  @field = field
  @term = term
  @type = type
  @field_namespace = field.to_s[/^(.+?)\./, 1]
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



3
4
5
# File 'lib/es-query-builder/token.rb', line 3

def field
  @field
end

#field_namespaceObject (readonly)

Returns the value of attribute field_namespace.



3
4
5
# File 'lib/es-query-builder/token.rb', line 3

def field_namespace
  @field_namespace
end

#fullObject (readonly)

Returns the value of attribute full.



3
4
5
# File 'lib/es-query-builder/token.rb', line 3

def full
  @full
end

#termObject (readonly)

Returns the value of attribute term.



3
4
5
# File 'lib/es-query-builder/token.rb', line 3

def term
  @term
end

Instance Method Details

#minus?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/es-query-builder/token.rb', line 16

def minus?
  @minus
end