Module: Trailblazer::Finder::Base
- Included in:
- Trailblazer::Finder
- Defined in:
- lib/trailblazer/finder/base.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#signal ⇒ Object
readonly
Returns the value of attribute signal.
Class Method Summary collapse
Instance Method Summary collapse
- #fetch_result ⇒ Object
-
#initialize(options = {}) ⇒ Object
rubocop:disable Style/OptionHash.
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
13 14 15 |
# File 'lib/trailblazer/finder/base.rb', line 13 def errors @errors end |
#signal ⇒ Object (readonly)
Returns the value of attribute signal.
13 14 15 |
# File 'lib/trailblazer/finder/base.rb', line 13 def signal @signal end |
Class Method Details
.included(base) ⇒ Object
7 8 9 10 11 |
# File 'lib/trailblazer/finder/base.rb', line 7 def self.included(base) base.include Helpers::Basic base.include Helpers::Sorting base.extend Dsl end |
Instance Method Details
#fetch_result ⇒ Object
24 25 26 27 28 |
# File 'lib/trailblazer/finder/base.rb', line 24 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 |
#initialize(options = {}) ⇒ Object
rubocop:disable Style/OptionHash
15 16 17 18 19 20 21 22 |
# File 'lib/trailblazer/finder/base.rb', line 15 def initialize( = {}) # rubocop:disable Style/OptionHash config = self.class.config ctx = {config: config, options: } @signal, (ctx, *) = Activities::Find.call([ctx, {}]) = @errors = ctx[:errors] || {} @find = ctx[:finder] end |