Sha256: 3ffaede560276c97243ff382a74434fc9955b1a6003ab775507bc2f23c4dff66

Contents?: true

Size: 790 Bytes

Versions: 3

Compression:

Stored size: 790 Bytes

Contents

module CurriculumGenerator
  module Generator
    class CvEntry < BasicGenerator

      def initialize(param, data, lang)
        super(param, data, lang)
      end

      def generate
        value = get_value(param)
        unless value.is_a?(Array)
          value = Array[value]
        end
        instance = self
        result = Either.chain do
          bind -> { value.is_a?(Array) }
          bind -> { instance.get_cv_entry(value) }
        end
        result.success? ? result.fetch : ''
      end

      protected

      def get_cv_entry(context)
        result = "\\cventry"
        context.each do |elem|
          result += "{#{elem}}"
        end
        (6 - context.size).times do
          result += '{}'
        end
        result # return
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
curriculum-generator-1.0.7 lib/curriculum-generator/generator/cv_entry.rb
curriculum-generator-1.0.6 lib/curriculum-generator/generator/cv_entry.rb
curriculum-generator-1.0.5 lib/curriculum-generator/generator/cv_entry.rb