Class: Kumi::Dev::Golden::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/kumi/dev/golden/generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema_name, schema_path, expected_dir) ⇒ Generator

Returns a new instance of Generator.



11
12
13
14
15
# File 'lib/kumi/dev/golden/generator.rb', line 11

def initialize(schema_name, schema_path, expected_dir)
  @schema_name = schema_name
  @schema_path = schema_path
  @expected_dir = expected_dir
end

Instance Attribute Details

#expected_dirObject (readonly)

Returns the value of attribute expected_dir.



9
10
11
# File 'lib/kumi/dev/golden/generator.rb', line 9

def expected_dir
  @expected_dir
end

#schema_nameObject (readonly)

Returns the value of attribute schema_name.



9
10
11
# File 'lib/kumi/dev/golden/generator.rb', line 9

def schema_name
  @schema_name
end

#schema_pathObject (readonly)

Returns the value of attribute schema_path.



9
10
11
# File 'lib/kumi/dev/golden/generator.rb', line 9

def schema_path
  @schema_path
end

Instance Method Details

#generate_all(representations, output_dir) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/kumi/dev/golden/generator.rb', line 25

def generate_all(representations, output_dir)
  FileUtils.mkdir_p(output_dir)

  representations.map do |repr|
    generate_representation(repr, output_dir)
  end
end

#update_all(representations) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/kumi/dev/golden/generator.rb', line 17

def update_all(representations)
  FileUtils.mkdir_p(expected_dir)

  representations.map do |repr|
    update_representation(repr)
  end
end