Class: Jimmy::Loaders::Base Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/jimmy/loaders/base.rb

Overview

This class is abstract.

Base class for all file loaders

Direct Known Subclasses

JSON, Ruby

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ Base

Returns a new instance of Base.

Parameters:

  • source (Pathname)

    The source file to load.



20
21
22
# File 'lib/jimmy/loaders/base.rb', line 20

def initialize(source)
  @source = Pathname(source)
end

Instance Attribute Details

#sourceObject (readonly)

The source file to be loaded.

Returns:

  • Pathname



17
18
19
# File 'lib/jimmy/loaders/base.rb', line 17

def source
  @source
end

Class Method Details

.call(file) ⇒ Object

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.

Load the given file. Intended to be used by a FileMap.

Parameters:

  • file (Pathname, String)

    Path of the file to load



11
12
13
# File 'lib/jimmy/loaders/base.rb', line 11

def self.call(file)
  new(file).load
end

Instance Method Details

#loadJimmy::Schema

Returns:

Raises:

  • (NotImplementedError)


25
26
27
# File 'lib/jimmy/loaders/base.rb', line 25

def load
  raise NotImplementedError, "Please implement #load on #{self.class}"
end