Class: CGen::Generator::CvItemWithComment
- Inherits:
-
BasicGenerator
- Object
- BasicGenerator
- CGen::Generator::CvItemWithComment
- Defined in:
- lib/cgen/generator/cv_item_with_comment.rb
Instance Attribute Summary
Attributes inherited from BasicGenerator
Instance Method Summary collapse
- #generate ⇒ Object
- #get_cv_item_with_comment(title, content, comment) ⇒ Object
-
#initialize(param, data, lang) ⇒ CvItemWithComment
constructor
A new instance of CvItemWithComment.
Methods inherited from BasicGenerator
Constructor Details
#initialize(param, data, lang) ⇒ CvItemWithComment
Returns a new instance of CvItemWithComment.
3 4 5 |
# File 'lib/cgen/generator/cv_item_with_comment.rb', line 3 def initialize(param, data, lang) super(param, data, lang) end |
Instance Method Details
#generate ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cgen/generator/cv_item_with_comment.rb', line 7 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 |
#get_cv_item_with_comment(title, content, comment) ⇒ Object
28 29 30 |
# File 'lib/cgen/generator/cv_item_with_comment.rb', line 28 def get_cv_item_with_comment(title, content, comment) "\\cvitemwithcomment{#{title}}{#{content}}{#{comment}}" end |