module ROM::Files::Dataset::Paths

Public Class Methods

included(other) click to toggle source
Calls superclass method
# File lib/rom/files/dataset/paths.rb, line 10
def self.included(other)
  super(other)
  other.extend ClassInterface
end

Public Instance Methods

count() click to toggle source

@return [Integer]

# File lib/rom/files/dataset/paths.rb, line 73
def count
  to_a.size
end
data() click to toggle source

@return [Array<Hash{Symbol => Pathname, String}>]

# File lib/rom/files/dataset/paths.rb, line 55
def data
  pluck(row_proc)
end
Also aliased as: to_a
each() { |row_proc| ... } click to toggle source

Iterate over data using row_proc

@return [Enumerator, Array] if block is not given

@api private

# 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() click to toggle source

@return [Array<Pathname>]

# 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 = nil, &block) click to toggle source

Pluck values from a pathname property

@overload pluck(field)

@example Usage with Symbol

users.pluck(:extname).uniq
# %w[.rb .rbw]

@param [#to_proc, nil] field A name of the property for extracting values from pathname

@overload pluck { |pathname| … }

@example Usage with block

users.pluck { |pathname| pathname.basename.to_s }
# [1, 2, 3]

@return [Array]

@api public

# File lib/rom/files/dataset/paths.rb, line 49
def pluck(field = nil, &block)
  block ||= field&.to_proc || row_proc
  paths.map(&block)
end
to_a()
Also aliased as: to_ary
Alias for: data
to_ary()
Alias for: to_a