Sha256: 518819752538871527f1e2ecca8e66e15c156971f5e3568bf4df6268471aa84c

Contents?: true

Size: 1.51 KB

Versions: 5

Compression:

Stored size: 1.51 KB

Contents

class CGen::Generator::WorkExperience < CGen::Generator::BasicGenerator

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

  def generate
    value = get_value(param)
    value.collect do |elem|
      get_work_experience(elem)
    end.join("\n")
  end

  protected

  def get_work_experience(context)

    context.merge!({'titles' => get_value('titles')})

    input = <<-CODE

    \\cventry

    <% if @date.nil? %>
      {}
    <% elsif @date.is_a?(Hash) && @date.has_key?('from') && @date.has_key?('to') %>
      {<%= @date['from'] %>\\\\<%= @date['to'] %>}
    <% else %>
      {<%= @date %>}
    <% end %>

    {<%= @occupation.nil? ? '' : @occupation %>}

    <% if @employer_name %>

      {
      <%= @employer_name %>
      <% if @type_of_business %>
        (<%= @type_of_business %>)
      <% end %>
      }

      <% if @employer_address %>
        {<%= @employer_address %>}
      <% end %>

    <% end %>

    {}

    {
    <% if @main_activities %>

      <% unless @main_activities.is_a?(Array) %>
        <% @main_activities = Array[@main_activities] %>
      <% end %>

      <% @main_activities.compact! %>

      <% if @main_activities.length > 0 %>

        \\textit{<%= @titles['S_3']['main_activities'] %>}:
        \\begin{itemize}

        <% @main_activities.each do |main_activity| %>
          \\item <%= main_activity %>
        <% end %>

        \\end{itemize}

      <% end %>

    <% end %>
    }

    CODE

    evaluate(input, context).gsub(/^\s+/,'').gsub(/\n/,'') + "\n\n"
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

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