Class: AnnualPlanner
- Inherits:
-
Object
- Object
- AnnualPlanner
- Defined in:
- lib/annual_planner.rb
Instance Attribute Summary collapse
-
#to_s ⇒ Object
readonly
Returns the value of attribute to_s.
Instance Method Summary collapse
-
#initialize(s = nil) ⇒ AnnualPlanner
constructor
A new instance of AnnualPlanner.
- #save(filename = @filename) ⇒ Object
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_s ⇒ Object (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 |