Class: Cure::Dsl::Queries

Inherits:
Object
  • Object
show all
Defined in:
lib/cure/dsl/queries.rb

Defined Under Namespace

Classes: Query

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeQueries

Returns a new instance of Queries.



12
13
14
# File 'lib/cure/dsl/queries.rb', line 12

def initialize
  @candidates = []
end

Instance Attribute Details

#candidatesObject (readonly)

Returns the value of attribute candidates.



10
11
12
# File 'lib/cure/dsl/queries.rb', line 10

def candidates
  @candidates
end

Instance Method Details

#find(named_range) ⇒ Object



21
22
23
# File 'lib/cure/dsl/queries.rb', line 21

def find(named_range)
  @candidates.find { |candidate| candidate.named_range.to_sym == named_range.to_sym }
end

#with(query:, named_range: "_default") ⇒ Object



16
17
18
19
# File 'lib/cure/dsl/queries.rb', line 16

def with(query:, named_range: "_default")
  candidate = Query.new(named_range.to_sym, query)
  @candidates << candidate
end