class Glima::QueryParameter

Public Class Methods

new(folder, query_string, context = nil) click to toggle source
# File lib/glima/query_parameter.rb, line 5
def initialize(folder, query_string, context = nil)
  @params = {}
  @folder, @query_string = folder, query_string

  if folder == "+all"
    @params[:q] = ""
  elsif /^\+(\S+)/ =~ folder
    @params[:q] = "in:\"#{$1}\""
  else
    fail "Unknown folder: #{folder}."
  end

  if query_string == "next"
    @params[:page_token] = context&.load_page_token
    raise FormatError.new("No more page") if @params[:page_token].to_s == ""
  else
    @params[:q] += " #{query_string}"
  end
end

Public Instance Methods

to_hash() click to toggle source
# File lib/glima/query_parameter.rb, line 25
def to_hash
  @params
end