Class: Grepfruit::Search
- Inherits:
-
Object
- Object
- Grepfruit::Search
- Defined in:
- lib/grepfruit/search.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#excluded_lines ⇒ Object
readonly
Returns the value of attribute excluded_lines.
-
#excluded_paths ⇒ Object
readonly
Returns the value of attribute excluded_paths.
-
#exclusions ⇒ Object
readonly
Returns the value of attribute exclusions.
-
#inclusions ⇒ Object
readonly
Returns the value of attribute inclusions.
-
#jobs ⇒ Object
readonly
Returns the value of attribute jobs.
-
#json ⇒ Object
readonly
Returns the value of attribute json.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#regex ⇒ Object
readonly
Returns the value of attribute regex.
-
#search_hidden ⇒ Object
readonly
Returns the value of attribute search_hidden.
-
#truncate ⇒ Object
readonly
Returns the value of attribute truncate.
Instance Method Summary collapse
-
#initialize(path:, regex:, exclude:, include:, truncate:, search_hidden:, jobs:, json: false, count: false) ⇒ Search
constructor
A new instance of Search.
Constructor Details
#initialize(path:, regex:, exclude:, include:, truncate:, search_hidden:, jobs:, json: false, count: false) ⇒ Search
Returns a new instance of Search.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/grepfruit/search.rb', line 11 def initialize(path:, regex:, exclude:, include:, truncate:, search_hidden:, jobs:, json: false, count: false) @path = File.(path) @regex = regex @exclusions = exclude @inclusions = include @excluded_lines, @excluded_paths = exclude.partition { _1.split("/").last.include?(":") } @truncate = truncate @search_hidden = search_hidden @jobs = jobs || Etc.nprocessors @json = json @count = count end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
9 10 11 |
# File 'lib/grepfruit/search.rb', line 9 def count @count end |
#excluded_lines ⇒ Object (readonly)
Returns the value of attribute excluded_lines.
9 10 11 |
# File 'lib/grepfruit/search.rb', line 9 def excluded_lines @excluded_lines end |
#excluded_paths ⇒ Object (readonly)
Returns the value of attribute excluded_paths.
9 10 11 |
# File 'lib/grepfruit/search.rb', line 9 def excluded_paths @excluded_paths end |
#exclusions ⇒ Object (readonly)
Returns the value of attribute exclusions.
9 10 11 |
# File 'lib/grepfruit/search.rb', line 9 def exclusions @exclusions end |
#inclusions ⇒ Object (readonly)
Returns the value of attribute inclusions.
9 10 11 |
# File 'lib/grepfruit/search.rb', line 9 def inclusions @inclusions end |
#jobs ⇒ Object (readonly)
Returns the value of attribute jobs.
9 10 11 |
# File 'lib/grepfruit/search.rb', line 9 def jobs @jobs end |
#json ⇒ Object (readonly)
Returns the value of attribute json.
9 10 11 |
# File 'lib/grepfruit/search.rb', line 9 def json @json end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
9 10 11 |
# File 'lib/grepfruit/search.rb', line 9 def path @path end |
#regex ⇒ Object (readonly)
Returns the value of attribute regex.
9 10 11 |
# File 'lib/grepfruit/search.rb', line 9 def regex @regex end |
#search_hidden ⇒ Object (readonly)
Returns the value of attribute search_hidden.
9 10 11 |
# File 'lib/grepfruit/search.rb', line 9 def search_hidden @search_hidden end |
#truncate ⇒ Object (readonly)
Returns the value of attribute truncate.
9 10 11 |
# File 'lib/grepfruit/search.rb', line 9 def truncate @truncate end |