Class: ClaudeMemory::Index::QueryOptions
- Inherits:
-
Object
- Object
- ClaudeMemory::Index::QueryOptions
- Defined in:
- lib/claude_memory/index/query_options.rb
Constant Summary collapse
- SCOPE_ALL =
:all- SCOPE_PROJECT =
:project- SCOPE_GLOBAL =
:global- DEFAULT_LIMIT =
20- DEFAULT_SCOPE =
SCOPE_ALL
Instance Attribute Summary collapse
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#query_text ⇒ Object
readonly
Returns the value of attribute query_text.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #for_global ⇒ Object
- #for_project ⇒ Object
- #hash ⇒ Object
-
#initialize(query_text:, limit: DEFAULT_LIMIT, scope: DEFAULT_SCOPE, source: nil) ⇒ QueryOptions
constructor
A new instance of QueryOptions.
- #with_limit(new_limit) ⇒ Object
Constructor Details
#initialize(query_text:, limit: DEFAULT_LIMIT, scope: DEFAULT_SCOPE, source: nil) ⇒ QueryOptions
Returns a new instance of QueryOptions.
15 16 17 18 19 20 21 |
# File 'lib/claude_memory/index/query_options.rb', line 15 def initialize(query_text:, limit: DEFAULT_LIMIT, scope: DEFAULT_SCOPE, source: nil) @query_text = query_text @limit = limit @scope = scope.to_sym @source = source&.to_sym freeze end |
Instance Attribute Details
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
13 14 15 |
# File 'lib/claude_memory/index/query_options.rb', line 13 def limit @limit end |
#query_text ⇒ Object (readonly)
Returns the value of attribute query_text.
13 14 15 |
# File 'lib/claude_memory/index/query_options.rb', line 13 def query_text @query_text end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
13 14 15 |
# File 'lib/claude_memory/index/query_options.rb', line 13 def scope @scope end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
13 14 15 |
# File 'lib/claude_memory/index/query_options.rb', line 13 def source @source end |
Instance Method Details
#==(other) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/claude_memory/index/query_options.rb', line 50 def ==(other) other.is_a?(QueryOptions) && other.query_text == query_text && other.limit == limit && other.scope == scope && other.source == source end |
#eql?(other) ⇒ Boolean
58 59 60 |
# File 'lib/claude_memory/index/query_options.rb', line 58 def eql?(other) self == other end |
#for_global ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/claude_memory/index/query_options.rb', line 32 def for_global self.class.new( query_text: query_text, limit: limit, scope: scope, source: :global ) end |
#for_project ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/claude_memory/index/query_options.rb', line 23 def for_project self.class.new( query_text: query_text, limit: limit, scope: scope, source: :project ) end |
#hash ⇒ Object
62 63 64 |
# File 'lib/claude_memory/index/query_options.rb', line 62 def hash [query_text, limit, scope, source].hash end |
#with_limit(new_limit) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/claude_memory/index/query_options.rb', line 41 def with_limit(new_limit) self.class.new( query_text: query_text, limit: new_limit, scope: scope, source: source ) end |