Module: ROM::Files::Dataset::Paths
- Included in:
- ROM::Files::Dataset
- Defined in:
- lib/rom/files/dataset/paths.rb
Defined Under Namespace
Modules: ClassInterface
Instance Attribute Summary collapse
- #row_proc ⇒ Proc readonly
Class Method Summary collapse
Instance Method Summary collapse
- #count ⇒ Integer
- #data ⇒ Array<Hash{Symbol => Pathname, String}> (also: #to_a)
-
#each ⇒ Enumerator, Array
private
Iterate over data using row_proc.
- #paths ⇒ Array<Pathname>
-
#pluck(field = nil, &block) ⇒ Array
Pluck values from a pathname property.
Instance Attribute Details
#row_proc ⇒ Proc (readonly)
|
# File 'lib/rom/files/dataset/paths.rb', line 22
|
Class Method Details
.included(other) ⇒ Object
10 11 12 13 |
# File 'lib/rom/files/dataset/paths.rb', line 10 def self.included(other) super(other) other.extend ClassInterface end |
Instance Method Details
#count ⇒ Integer
73 74 75 |
# File 'lib/rom/files/dataset/paths.rb', line 73 def count to_a.size end |
#data ⇒ Array<Hash{Symbol => Pathname, String}> Also known as: to_a
55 56 57 |
# File 'lib/rom/files/dataset/paths.rb', line 55 def data pluck(row_proc) end |
#each ⇒ Enumerator, Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Iterate over data using row_proc
67 68 69 70 |
# File 'lib/rom/files/dataset/paths.rb', line 67 def each return to_enum unless block_given? paths.each { |tuple| yield(row_proc[tuple]) } end |
#paths ⇒ Array<Pathname>
26 27 28 |
# File 'lib/rom/files/dataset/paths.rb', line 26 def paths connection.search(search_patterns, exclude_patterns: exclude_patterns, sorting: sorting, path: path) end |
#pluck(field) ⇒ Array #pluck({ |pathname| ... }) ⇒ Array
Pluck values from a pathname property
49 50 51 52 |
# File 'lib/rom/files/dataset/paths.rb', line 49 def pluck(field = nil, &block) block ||= field&.to_proc || row_proc paths.map(&block) end |