Class: ROM::Files::Dataset

Inherits:
Memory::Dataset
  • Object
show all
Extended by:
Forwardable
Includes:
Filtering, MimeType, Paths, Sorting
Defined in:
lib/rom/files/dataset.rb,
lib/rom/files/dataset/paths.rb,
lib/rom/files/dataset/sorting.rb,
lib/rom/files/dataset/filtering.rb,
lib/rom/files/dataset/mime_type.rb

Defined Under Namespace

Modules: Filtering, MimeType, Paths, Sorting

Instance Attribute Summary collapse

Attributes included from Sorting

#sorting

Attributes included from Paths

#row_proc

Attributes included from MimeType

#mime_type

Attributes included from Filtering

#exclude_patterns, #include_patterns, #inside_paths, #search_recursive

Instance Method Summary collapse

Methods included from Sorting

included, #sort

Methods included from Paths

#count, #data, #each, included, #paths, #pluck

Methods included from MimeType

included, #mime

Methods included from Filtering

included, #inside, #inside_append, #not_recursive, #recursive, #recursive?, #reject, #reject_append, #search_patterns, #select, #select_append

Constructor Details

#initialize(mime_type: nil, inside_paths: ['.'], include_patterns: ['*'], exclude_patterns: [], sorting: nil) ⇒ Object

Parameters:



# File 'lib/rom/files/dataset.rb', line 28

Instance Attribute Details

#connectionConnection (readonly)

Returns:



40
# File 'lib/rom/files/dataset.rb', line 40

option :connection, default: proc { Connection.new }

#pathConnection (readonly)

Returns:



44
# File 'lib/rom/files/dataset.rb', line 44

option :path, Types::Coercible::Pathname, default: proc { connection.path }

Instance Method Details

#at(path) ⇒ Object



46
47
48
# File 'lib/rom/files/dataset.rb', line 46

def at(path)
  with(path: Pathname(path))
end

#dig(path) ⇒ Object



50
51
52
# File 'lib/rom/files/dataset.rb', line 50

def dig(path)
  with(path: self.path.join(path))
end

#join(*args) ⇒ Dataset

Join with other datasets

Parameters:

  • args (Array<Dataset>)

    A list of dataset to join with

Returns:



# File 'lib/rom/files/dataset.rb', line 69

#project(*names) ⇒ Dataset

Project a dataset

Parameters:

  • names (Array<Symbol>)

    A list of attribute names

Returns:



# File 'lib/rom/files/dataset.rb', line 60

#restrict(criteria = nil) ⇒ Dataset

Restrict a dataset

Parameters:

  • criteria (Hash) (defaults to: nil)

    A hash with conditions

Returns:



# File 'lib/rom/files/dataset.rb', line 79

#up(level = 1) ⇒ Object



54
55
56
57
58
# File 'lib/rom/files/dataset.rb', line 54

def up(level = 1)
  path = self.path
  level.times { path = path.dirname }
  with(path: path)
end