Module: EntityCache::Controls::Store::External

Defined in:
lib/entity_cache/controls/store/external.rb,
lib/entity_cache/controls/store/external/write.rb,
lib/entity_cache/controls/store/external/example.rb,
lib/entity_cache/controls/store/external/not_implemented.rb

Defined Under Namespace

Modules: NotImplemented, Write Classes: Example

Class Method Summary collapse

Class Method Details

.example(subject = nil, entity_class: nil, specifier: nil, random: nil) ⇒ Object


5
6
7
8
9
10
11
# File 'lib/entity_cache/controls/store/external.rb', line 5

def self.example(subject=nil, entity_class: nil, specifier: nil, random: nil)
  random = true if random.nil?

  subject ||= Subject.example(random: random, entity_class: entity_class, specifier: specifier)

  Example.build(subject)
end

.file_dump_directoryObject


65
66
67
# File 'lib/entity_cache/controls/store/external/example.rb', line 65

def self.file_dump_directory
  "tmp"
end

.path(subject, id = nil) ⇒ Object


55
56
57
58
59
60
61
62
63
# File 'lib/entity_cache/controls/store/external/example.rb', line 55

def self.path(subject, id=nil)
  id ||= ID.example

  filename = "#{subject.to_s.gsub('/', '-')}-#{id}.yaml"

  full_name = File.join(file_dump_directory, filename)

  full_name
end