Class: DailyReflection
- Inherits:
-
WikiMd
- Object
- WikiMd
- DailyReflection
- Defined in:
- lib/daily_reflection.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
Returns the value of attribute date.
Instance Method Summary collapse
- #add_entry(s) ⇒ Object
- #create_day ⇒ Object
- #create_month ⇒ Object
- #create_week ⇒ Object
- #create_year ⇒ Object
- #find_date(d) ⇒ Object
-
#initialize(s = nil, debug: false, date: Date.today, period: :daily, title: "My #{period.to_s.capitalize} Reflection") ⇒ DailyReflection
constructor
A new instance of DailyReflection.
- #today ⇒ Object
Constructor Details
#initialize(s = nil, debug: false, date: Date.today, period: :daily, title: "My #{period.to_s.capitalize} Reflection") ⇒ DailyReflection
Returns a new instance of DailyReflection.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/daily_reflection.rb', line 13 def initialize(s=nil, debug: false, date: Date.today, period: :daily, title: "My #{period.to_s.capitalize} Reflection" ) @date, @period = date, period super(s, order: 'descending', debug: debug, title: title) check_period_entry() end |
Instance Attribute Details
#date ⇒ Object
Returns the value of attribute date.
11 12 13 |
# File 'lib/daily_reflection.rb', line 11 def date @date end |
Instance Method Details
#add_entry(s) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/daily_reflection.rb', line 24 def add_entry(s) check_period_entry() e = Entry.new(@dxsx.dx.all.first) e.body = e.body + "\n" + s update_index(@dx.all.first, e..join(' ')) save_files() end |
#create_day ⇒ Object
40 41 42 |
# File 'lib/daily_reflection.rb', line 40 def create_day() create_date_entry(@date) end |
#create_month ⇒ Object
53 54 55 |
# File 'lib/daily_reflection.rb', line 53 def create_month() create_date_entry(Date.civil(@date.year, @date.month, -1)) end |
#create_week ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/daily_reflection.rb', line 44 def create_week() d = @date d += 1 until d.wday == 0 create_date_entry(d) end |
#create_year ⇒ Object
57 58 59 |
# File 'lib/daily_reflection.rb', line 57 def create_year() create_date_entry(Date.new(@date.year+1,1,1)-1) end |
#find_date(d) ⇒ Object
35 36 37 |
# File 'lib/daily_reflection.rb', line 35 def find_date(d) self.find d.strftime("%-d %b %Y") end |
#today ⇒ Object
61 62 63 |
# File 'lib/daily_reflection.rb', line 61 def today() Entry.new(@dxsx.dx.all.first) end |