Class: Ritsu::SrcFiles::ExecutableCmakeLists::ExecutableTemplate

Inherits:
Template
  • Object
show all
Defined in:
lib/ritsu/src_files/executable_cmake_lists.rb

Instance Attribute Summary collapse

Attributes included from BlockMixin

#contents, #id, #indent_length, #indent_level, #local_indentation

Instance Method Summary collapse

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(target, parent) ⇒ ExecutableTemplate

Returns a new instance of ExecutableTemplate.



10
11
12
13
14
# File 'lib/ritsu/src_files/executable_cmake_lists.rb', line 10

def initialize(target, parent)
  super("ExecutableCmakeLists -- #{target.name} -- Executable")
  @target = target
  @parent = parent
end

Instance Attribute Details

#parentObject

Returns the value of attribute parent.



8
9
10
# File 'lib/ritsu/src_files/executable_cmake_lists.rb', line 8

def parent
  @parent
end

#targetObject

Returns the value of attribute target.



7
8
9
# File 'lib/ritsu/src_files/executable_cmake_lists.rb', line 7

def target
  @target
end

Instance Method Details

#update_block(block, options = {}) ⇒ Object



16
17
18
19
# File 'lib/ritsu/src_files/executable_cmake_lists.rb', line 16

def update_block(block, options={})
  block.contents.clear
  block.contents << "ADD_EXECUTABLE(#{@target.name} ${#{@parent.source_files_template.src_files_var_name}})"
end