Class: ContainedMr::Mock::Template

Inherits:
Object
  • Object
show all
Includes:
TemplateLogic
Defined in:
lib/contained_mr/mock/template.rb

Overview

See Also:

  • {ContainedMr{ContainedMr::Template}

Instance Attribute Summary collapse

Attributes included from TemplateLogic

#id, #image_id, #item_count, #name_prefix

Instance Method Summary collapse

Methods included from TemplateLogic

#image_tag, #mapper_dockerfile, #mapper_env, #mapper_output_path, #new_job, #reducer_dockerfile, #reducer_env, #reducer_output_path

Constructor Details

#initialize(name_prefix, id, zip_io) ⇒ Template

Returns a new instance of Template.

See Also:

  • ContainedMr::Mock::Template.{ContainedMr{ContainedMr::Template{ContainedMr::Template#initialize}


18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/contained_mr/mock/template.rb', line 18

def initialize(name_prefix, id, zip_io)
  @name_prefix = name_prefix
  @id = id
  @image_id = 'mock-template-image-id'
  @item_count = nil
  @_definition = nil

  @destroyed = false
  @_zip_contents = {}

  process_zip zip_io
end

Instance Attribute Details

#_definitionHash<String, Object> (readonly)

Returns YAML-parsed mapreduced.yml.

Returns:

  • (Hash<String, Object>)

    YAML-parsed mapreduced.yml



4
5
6
# File 'lib/contained_mr/mock/template.rb', line 4

def _definition
  @_definition
end

#_zip_contentsHash<String, Symbol|String> (readonly)

Returns maps file names in the template .zip to their contents, and maps directory entries to the :directory symbol.

Returns:

  • (Hash<String, Symbol|String>)

    maps file names in the template .zip to their contents, and maps directory entries to the :directory symbol



8
9
10
# File 'lib/contained_mr/mock/template.rb', line 8

def _zip_contents
  @_zip_contents
end

Instance Method Details

#destroy!Object

See Also:

  • ContainedMr::Mock::Template.{ContainedMr{ContainedMr::Template{ContainedMr::Template#destroy!}


32
33
34
35
# File 'lib/contained_mr/mock/template.rb', line 32

def destroy!
  @destroyed = true
  self
end

#destroyed?Boolean

Returns true if #destroy! was called.

Returns:



13
14
15
# File 'lib/contained_mr/mock/template.rb', line 13

def destroyed?
  @destroyed
end

#job_classObject

See Also:

  • ContainedMr::Mock::Template.{ContainedMr{ContainedMr::Template{ContainedMr::Template#new_job}


38
39
40
# File 'lib/contained_mr/mock/template.rb', line 38

def job_class
  ContainedMr::Mock::Job
end