Sha256: c6b3b5dd70992435d2a99d5a81ac3adfdc292414f55657062a6b63f0feb3888c

Contents?: true

Size: 778 Bytes

Versions: 5

Compression:

Stored size: 778 Bytes

Contents

class CGen::Generator::CvColumn < CGen::Generator::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
    ("\\begin{cvcolumns}" + (value.collect do |elem|
      instance = self
      result = Either.chain do
        bind -> { elem.is_a?(Hash) }
        bind -> { elem.has_key?('item_0') && elem.has_key?('item_1') }
        bind -> {
          instance.get_cv_list_double_item(elem['item_0'], elem['item_1'])
        }
      end
      result.success? ? result.fetch : ''
    end.join("\n")) +
    "\\end{cvcolumns")
  end

  protected

  def get_cv_list_double_item(item_0, item_1)
    "\\cvcolumn{#{item_0}}{#{item_1}}"
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

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