Method: MarkLogic::Queries::ValueQuery#options

Defined in:
lib/marklogic/queries/value_query.rb

#optionsObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/marklogic/queries/value_query.rb', line 17

def options
  opts = []
  @options.each do |k, v|
    dashed_key = k.to_s.gsub(/_/, '-')
    case k.to_s
    when "lang", "min_occurs", "max_occurs"
      opts << %Q{"#{dashed_key}=#{v}"}
    when /(case|diacritic|punctuation|whitespace)_sensitive/
      opts << (v == true ? %Q{"#{$1}-sensitive"} : %Q{"#{$1}-insensitive"})
    when "exact"
      opts << %Q{"#{dashed_key}"}
    when "stemmed", "wildcarded"
      opts << (v == true ? %Q{"#{dashed_key}"} : %Q{"un#{dashed_key}"})
    else
      opts << %Q{"#{v}"}
    end
  end

  opts
end