Module: LedgerSync::SearchResult::ResultTypeBase

Defined in:
lib/ledger_sync/result.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#resourcesObject (readonly)

Returns the value of attribute resources.



59
60
61
# File 'lib/ledger_sync/result.rb', line 59

def resources
  @resources
end

#searcherObject (readonly)

Returns the value of attribute searcher.



59
60
61
# File 'lib/ledger_sync/result.rb', line 59

def searcher
  @searcher
end

Class Method Details

.included(base) ⇒ Object



61
62
63
64
65
66
67
68
69
70
# File 'lib/ledger_sync/result.rb', line 61

def self.included(base)
  base.class_eval do
    # TODO: removed next and previous searcher, because it causes a string of them.
    # We should add next_searcher_params which would be easier to serialize.
    simply_serialize only: %i[
      resources
      searcher
    ]
  end
end

Instance Method Details

#initialize(*args, searcher:, **keywords) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument



72
73
74
75
76
# File 'lib/ledger_sync/result.rb', line 72

def initialize(*args, searcher:, **keywords) # rubocop:disable Lint/UnusedMethodArgument
  @resources = searcher.resources
  @searcher = searcher
  super(*args)
end

#next_searcherObject



78
79
80
# File 'lib/ledger_sync/result.rb', line 78

def next_searcher
  searcher.next_searcher
end

#next_searcher?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/ledger_sync/result.rb', line 82

def next_searcher?
  !next_searcher.nil?
end

#previous_searcherObject



86
87
88
# File 'lib/ledger_sync/result.rb', line 86

def previous_searcher
  searcher.previous_searcher
end

#previous_searcher?Boolean

Returns:

  • (Boolean)


90
91
92
# File 'lib/ledger_sync/result.rb', line 90

def previous_searcher?
  !previous_searcher.nil?
end