Class: Eson::Search::QueryField

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/eson/search/query_field.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, *fields) ⇒ QueryField

Returns a new instance of QueryField.



6
7
8
9
10
11
12
13
14
# File 'lib/eson/search/query_field.rb', line 6

def initialize(name, *fields)
  @_name = name

  if fields.length == 1 && Hash === fields.first
    super(fields.first)
  else
    @list = fields
  end
end

Instance Method Details

#_nameObject



24
25
26
# File 'lib/eson/search/query_field.rb', line 24

def _name
  @_name
end

#_optionsObject



28
29
30
# File 'lib/eson/search/query_field.rb', line 28

def _options
  @_table
end

#to_query_hashObject



16
17
18
19
20
21
22
# File 'lib/eson/search/query_field.rb', line 16

def to_query_hash
  if @list
    { _name => @list }
  else
    { _name => @table }
  end
end