Class: RubyPoint::File

Inherits:
Element show all
Defined in:
lib/rubypoint/file.rb

Instance Attribute Summary collapse

Attributes inherited from Element

#objects, #parent, #presentation

Instance Method Summary collapse

Methods inherited from Element

class_attributes

Instance Attribute Details

#docObject

Returns the value of attribute doc.



3
4
5
# File 'lib/rubypoint/file.rb', line 3

def doc
  @doc
end

#file_pathObject

Returns the value of attribute file_path.



3
4
5
# File 'lib/rubypoint/file.rb', line 3

def file_path
  @file_path
end

Instance Method Details

#<<(object) ⇒ Object



15
16
17
18
# File 'lib/rubypoint/file.rb', line 15

def <<(object)
  object.parent = self
  self.objects << object
end

#writeObject



5
6
7
8
9
10
11
12
13
# File 'lib/rubypoint/file.rb', line 5

def write
  self.before_write if self.respond_to?(:before_write)
  self.objects.each do |o|
    o.write
  end
  File.open(@file_path, "w") do |f|
    f.puts self.doc
  end
end