module Trailblazer::Finder::Base

Attributes

errors[R]
signal[R]

Public Class Methods

included(base) click to toggle source
# File lib/trailblazer/finder/base.rb, line 9
def self.included(base)
  base.include Helpers::Basic
  base.include Helpers::Sorting
  base.extend Finder::Dsl
end
new(options = {}) click to toggle source
# File lib/trailblazer/finder/base.rb, line 17
def initialize(options = {}) # rubocop:disable Style/OptionHash
  config = self.class.config
  ctx = {config: config, options: options}
  @signal, (ctx, *) = Activities::Find.call([ctx, {}])
  @options = options
  @errors = ctx[:errors] || {}
  @find = ctx[:finder]
end

Public Instance Methods

fetch_result() click to toggle source
# File lib/trailblazer/finder/base.rb, line 26
def fetch_result
  result = @find.query self
  result = Utils::Array.convert_hashes_in_array_to_struct(result) if result.first.is_a?(Hash)
  result
end