Class: Indocker::ImageMetadataRepository

Inherits:
Object
  • Object
show all
Includes:
SmartIoC::Iocify
Defined in:
lib/indocker/image/image_metadata_repository.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, **args) ⇒ Object



25
26
27
28
29
# File 'lib/indocker/image/image_metadata_repository.rb', line 25

def method_missing(method, **args)
  tag = args[:tag] || Indocker::ImageMetadata::DEFAULT_TAG

  find_by_repo(method, tag: tag)
end

Instance Method Details

#all ⇒ Object



21
22
23
# File 'lib/indocker/image/image_metadata_repository.rb', line 21

def all
  @all ||= []
end

#clear ⇒ Object



17
18
19
# File 'lib/indocker/image/image_metadata_repository.rb', line 17

def clear
  @all = []
end

#find_by_repo(repo, tag: Indocker::ImageMetadata::DEFAULT_TAG) ⇒ Object



10
11
12
13
14
15
# File 'lib/indocker/image/image_metadata_repository.rb', line 10

def find_by_repo(repo, tag: Indocker::ImageMetadata::DEFAULT_TAG)
   = all.detect { |im| im.repo == repo.intern and im.tag == tag.intern }
  raise Indocker::Errors::ImageIsNotDefined, "#{repo}:#{tag}" if .nil?

  
end

#put(image_metadata) ⇒ Object



6
7
8
# File 'lib/indocker/image/image_metadata_repository.rb', line 6

def put()
  all.push()
end