Sha256: 1023b16b8129449651ca5057c6d62754738998ff48ff6b0bed76854a98cfa884

Contents?: true

Size: 823 Bytes

Versions: 5

Compression:

Stored size: 823 Bytes

Contents

class CGen::Generator::CvItemWithComment < CGen::Generator::BasicGenerator

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

  def generate
    value = get_value(param)
    value = Array[value] unless value.is_a?(Array)

    inst = self
    value.collect do |elem|
      result = Either.chain do
        bind -> { elem.is_a?(Hash) }
        bind -> {
          elem.has_key?('title') &&
              elem.has_key?('content') &&
              elem.has_key?('comment')
        }
        bind -> {
          inst.get_cv_item_with_comment(elem['title'], elem['content'], elem['comment'])
        }
      end
      result.success? ? result.fetch : ''
    end.join("\n")
  end

  def get_cv_item_with_comment(title, content, comment)
    "\\cvitemwithcomment{#{title}}{#{content}}{#{comment}}"
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
curriculum-generator-1.0.4 lib/cgen/generator/cv_item_with_comment.rb
curriculum-generator-1.0.3 lib/cgen/generator/cv_item_with_comment.rb
curriculum-generator-1.0.2 lib/cgen/generator/cv_item_with_comment.rb
curriculum-generator-1.0.1 lib/cgen/generator/cv_item_with_comment.rb
curriculum-generator-1.0.0 lib/cgen/generator/cv_item_with_comment.rb