Sha256: 61d5defbf58cb7439a13099f79ef98071a2b81200a4d4d34404a3022639af38e
Contents?: true
Size: 1.4 KB
Versions: 17
Compression:
Stored size: 1.4 KB
Contents
require 'json' module Generator # Contains methods accessible to the ERB template class TemplateValues attr_reader :abbreviated_commit_hash, :version, :exercise_name, :test_cases, :canonical_data_version def initialize(abbreviated_commit_hash:, version:, exercise_name:, test_cases:, canonical_data_version: nil) @abbreviated_commit_hash = abbreviated_commit_hash @version = version @exercise_name = exercise_name @test_cases = test_cases @canonical_data_version = canonical_data_version end def get_binding binding end def exercise_name_camel exercise_name.split('_').map(&:capitalize).join end end module TemplateValuesFactory def template_values TemplateValues.new( abbreviated_commit_hash: canonical_data.abbreviated_commit_hash, canonical_data_version: canonical_data.version, version: version, exercise_name: slug_underscore, test_cases: extract ) end private def slug_underscore slug ? slug.tr('-_', '_') : '' end def extract load cases_load_name extractor.cases(canonical_data.to_s) end def extractor CaseValues::Extractor.new( case_class: Object.const_get(Files::GeneratorCases.class_name(slug)) ) end def cases_load_name Files::GeneratorCases.source_filepath(paths.track, slug) end end end
Version data entries
17 entries across 17 versions & 1 rubygems