class ROM::Files::Gateway

Files gateway interface

@example

gateway = ROM::Files::Gateway.new('.')
gateway.dataset(:lib)
gateway[:lib].insert(name: 'rom.rb')

@api public

Attributes

logger[R]

@return [Object] default logger

@api public

Public Class Methods

new(root = Pathname.pwd, extensions: []) click to toggle source

@param root [Pathname, to_s] @param extensions [Array<Symbol>, Symbol]

# File lib/rom/files/gateway.rb, line 27
def initialize(root = Pathname.pwd, extensions: [])
  @connection = Connection.new(root)
  Files.load_extensions(*Array(extensions))
end

Public Instance Methods

dataset(name) click to toggle source

@param name [Pathname, to_s] @return [Dataset]

# File lib/rom/files/gateway.rb, line 48
def dataset(name)
  self[name] || connection.create_dataset(name)
end
use_logger(logger) click to toggle source

Set default logger for the gateway

@param logger [Logger] object

@api public

# File lib/rom/files/gateway.rb, line 42
def use_logger(logger)
  @logger = logger
end