Class: Yuriita::Definitions::Scope

Inherits:
Object
  • Object
show all
Defined in:
lib/yuriita/definitions/scope.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options:, combination:) ⇒ Scope

Returns a new instance of Scope.



6
7
8
9
# File 'lib/yuriita/definitions/scope.rb', line 6

def initialize(options:, combination:)
  @options = options
  @combination = combination
end

Instance Attribute Details

#combinationObject (readonly)

Returns the value of attribute combination.



4
5
6
# File 'lib/yuriita/definitions/scope.rb', line 4

def combination
  @combination
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/yuriita/definitions/scope.rb', line 4

def options
  @options
end

Instance Method Details

#apply(query:) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/yuriita/definitions/scope.rb', line 11

def apply(query:)
  filters = selected_filters(query)
  keywords = query.keywords

  if keywords.present?
    Clauses::Search.new(
      filters: filters,
      keywords: keywords,
      combination: combination,
    )
  else
    Clauses::Identity.new
  end
end