class Shard::Loader

Constants

SHARD_FILE_PATTERN
TEST_FILE_PATTERNS

Attributes

ref[R]

Public Class Methods

load(shard_line) click to toggle source
#

Class Methods #

#
# File lib/shard/loader.rb, line 34
def self.load(shard_line)
  new(shard_line).load
end
new(shard_line) click to toggle source
#

Constructor #

#
# File lib/shard/loader.rb, line 24
def initialize(shard_line)
  @ref = Shard::Ref(shard_line)
end
test(shard_line) click to toggle source
# File lib/shard/loader.rb, line 38
def self.test(shard_line)
  new(shard_line).test
end

Public Instance Methods

load() click to toggle source
#

Instance Methods #

#
# File lib/shard/loader.rb, line 48
def load
  load_file(SHARD_FILE_PATTERN)
end
load_file(filename) click to toggle source
# File lib/shard/loader.rb, line 52
def load_file(filename)
  ensure_shard_saved

  require find_file_path(ref, filename)
end
test() click to toggle source
# File lib/shard/loader.rb, line 58
def test
  ensure_shard_saved

  require *find_file_paths(ref, *TEST_FILE_PATTERNS)
end

Private Instance Methods

ensure_shard_saved() click to toggle source
# File lib/shard/loader.rb, line 66
def ensure_shard_saved
  Shard::Saver.save ref, lazy: true
end