Class: NestedFile::FileSection::Write

Inherits:
Object
  • Object
show all
Includes:
FromHash
Defined in:
lib/nested_file/file_section.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#full_file_to_insertObject

Returns the value of attribute full_file_to_insert.



27
28
29
# File 'lib/nested_file/file_section.rb', line 27

def full_file_to_insert
  @full_file_to_insert
end

#parent_bodyObject

Returns the value of attribute parent_body.



27
28
29
# File 'lib/nested_file/file_section.rb', line 27

def parent_body
  @parent_body
end

Instance Method Details

#should_write?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/nested_file/file_section.rb', line 33

def should_write?
  trimmed_parent_body.present?
end

#write!Object



36
37
38
39
40
# File 'lib/nested_file/file_section.rb', line 36

def write!
  return unless should_write?
  log "writing to #{full_file_to_insert}"
  File.create full_file_to_insert, trimmed_parent_body
end