Module: Doing::ItemQuery

Included in:
Item
Defined in:
lib/doing/item/query.rb

Overview

Tag and search filtering for a Doing entry

Instance Method Summary collapse

Instance Method Details

#highlight_search(search, distance: nil, negate: false, case_type: nil) ⇒ Object

#ignore_case(search, case_type) ⇒ Boolean

Determine if case should be ignored for searches

Parameters:

  • search (String)

    The search string

  • case_type (Symbol)

    The case type

Returns:

  • (Boolean)

    case should be ignored

#keep_item?(opt) ⇒ Boolean

Used by filter_items determine whether an item matches a set of criteria

Parameters:

  • opt (Hash)

    filter parameters

Returns:

  • (Boolean)

    whether the item matches all filter criteria

#search(search, distance: nil, negate: false, case_type: nil) ⇒ Boolean

Test if item matches search string

Parameters:

  • search (String)

    The search string

  • negate (Boolean) (defaults to: false)

    negate results

  • case_type (Symbol) (defaults to: nil)

    The case-sensitivity type (:sensitive, :ignore, :smart)

Returns:

  • (Boolean)

    matches search criteria

#tag_values?(queries, bool = :and, negate: false) ⇒ Boolean

Test if item matches tag values

Parameters:

  • queries (Array)

    The tag value queries to test

  • bool (Symbol) (defaults to: :and)

    The boolean to use for multiple tags (:and, :or, :not)

  • negate (Boolean) (defaults to: false)

    negate the result?

Returns:

  • (Boolean)

    true if tag/bool combination passes

#tags?(tags, bool = :and, negate: false) ⇒ Boolean

Test if item contains tag(s)

Parameters:

  • tags (Array or String)

    The tags to test. Can be an array or a comma-separated string.

  • bool (Symbol) (defaults to: :and)

    The boolean to use for multiple tags (:and, :or, :not)

  • negate (Boolean) (defaults to: false)

    negate the result?

Returns:

  • (Boolean)

    true if tag/bool combination passes