class FileTree

Public Class Methods

add(files) click to toggle source
# File lib/dynalist/file_tree.rb, line 27
def self.add(files)
  @@files << files
  @@files.flatten!
end
clear() click to toggle source
# File lib/dynalist/file_tree.rb, line 23
def self.clear
  @@files = []
end
find_by(**query) click to toggle source
# File lib/dynalist/file_tree.rb, line 32
def self.find_by(**query)
  @@files.find { |file| file.include(**query) }
end
where(**query) click to toggle source
# File lib/dynalist/file_tree.rb, line 36
def self.where(**query)
  @@files.select do |file|
    query.all? do |key, value|
      if value.kind_of? Array
        value.any? { |v| file.include(**{key => v}) }
      else
        file.include(**{key => value})
      end
    end
  end
end

Public Instance Methods

files() click to toggle source
# File lib/dynalist/file_tree.rb, line 19
def files
  @@files
end
root_id() click to toggle source
# File lib/dynalist/file_tree.rb, line 15
def root_id
  @@root_id
end
root_id=(root_id) click to toggle source
# File lib/dynalist/file_tree.rb, line 11
def root_id=(root_id)
  @@root_id = root_id
end