Class: Ritsu::SrcFiles::ProjectCmakeLists::DirectoriesTemplate
- Defined in:
- lib/ritsu/src_files/project_cmake_lists.rb
Instance Attribute Summary
Attributes included from BlockMixin
#contents, #id, #indent_length, #indent_level, #local_indentation
Instance Method Summary collapse
-
#initialize(project) ⇒ DirectoriesTemplate
constructor
A new instance of DirectoriesTemplate.
- #update_block(block, options = {}) ⇒ Object
Methods inherited from Template
#add_content, #add_template, #child_template_with_id, #child_template_with_id_position, #child_templates, #create_block
Methods included from BlockMixin
#add_line, #add_new_line, #block_structure?, #clear_contents, #indent, #initialize_block_mixin, #outdent
Constructor Details
#initialize(project) ⇒ DirectoriesTemplate
Returns a new instance of DirectoriesTemplate.
69 70 71 72 |
# File 'lib/ritsu/src_files/project_cmake_lists.rb', line 69 def initialize(project) super("ProjectCmakeLists -- Directories") @project = project end |
Instance Method Details
#update_block(block, options = {}) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/ritsu/src_files/project_cmake_lists.rb', line 74 def update_block(block, ={}) block.contents.clear targets = @project.targets_sorted_by_topological_order targets.sort! { |x,y| if x.topological_order < y.topological_order -1 elsif x.topological_order > y.topological_order 1 else x.name <=> y.name end } targets.each do |target| block.contents << "ADD_SUBDIRECTORY(#{target.name})" end end |