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.



53
54
55
# File 'lib/ledger_sync/result.rb', line 53

def resources
  @resources
end

#searcherObject (readonly)

Returns the value of attribute searcher.



53
54
55
# File 'lib/ledger_sync/result.rb', line 53

def searcher
  @searcher
end

Class Method Details

.included(base) ⇒ Object



55
56
57
58
59
60
61
62
63
64
# File 'lib/ledger_sync/result.rb', line 55

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



66
67
68
69
70
# File 'lib/ledger_sync/result.rb', line 66

def initialize(*args, searcher:, **keywords)
  @resources = searcher.resources
  @searcher = searcher
  super(*args, **keywords)
end

#next_searcherObject



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

def next_searcher
  searcher.next_searcher
end

#next_searcher?Boolean

Returns:

  • (Boolean)


76
77
78
# File 'lib/ledger_sync/result.rb', line 76

def next_searcher?
  !next_searcher.nil?
end

#previous_searcherObject



80
81
82
# File 'lib/ledger_sync/result.rb', line 80

def previous_searcher
  searcher.previous_searcher
end

#previous_searcher?Boolean

Returns:

  • (Boolean)


84
85
86
# File 'lib/ledger_sync/result.rb', line 84

def previous_searcher?
  !previous_searcher.nil?
end