File: doc.rb

package info (click to toggle)
ruby-oj 3.16.15-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,208 kB
  • sloc: ansic: 20,028; ruby: 11,642; sh: 70; makefile: 17
file content (35 lines) | stat: -rw-r--r-- 759 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require 'sample/hasprops'
require 'sample/group'
require 'sample/layer'
require 'sample/line'
require 'sample/shape'
require 'sample/oval'
require 'sample/rect'
require 'sample/text'
require 'sample/change'

module Sample
  class Doc
    include HasProps
    
    attr_accessor :title
    attr_accessor :create_time
    attr_accessor :user
    # Hash of layers in the document indexed by layer name.
    attr_reader :layers
    attr_reader :change_history

    def initialize(title)
      @title = title
      @user = ENV['USER']
      @create_time = Time.now
      @layers = { }
      @change_history = []
    end
    
    def add_change(comment, time=nil, user=nil)
      @change_history << Change.new(comment, time, user)
    end

  end # Doc
end # Sample