Class: AnnualPlanner

Inherits:
Object
  • Object
show all
Defined in:
lib/annual_planner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(s = nil) ⇒ AnnualPlanner

Returns a new instance of AnnualPlanner.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/annual_planner.rb', line 10

def initialize(s=nil)

  if s then

    # open the file

  else

    # create a new file
    @filename = 'annual_planner.txt'

  end

end

Instance Attribute Details

#to_sObject (readonly)

Returns the value of attribute to_s.



8
9
10
# File 'lib/annual_planner.rb', line 8

def to_s
  @to_s
end

Instance Method Details

#save(filename = @filename) ⇒ Object



25
26
27
28
29
# File 'lib/annual_planner.rb', line 25

def save(filename=@filename)

  @filename = filename if filename  
  File.write @filename, self.to_s
end