Class: Devlog::Zezzion

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/devlog.rb

Constant Summary collapse

COM =

communication session

1
COD =

coding session

0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(zztype = COD) ⇒ Zezzion

Returns a new instance of Zezzion.



661
662
663
664
665
666
667
668
669
670
671
672
673
# File 'lib/devlog.rb', line 661

def initialize(zztype = COD)
  @zztype = zztype
  @zzbegin = nil
  @zzend = nil
  @zzbegin = nil
  @zzbegin_title = nil
  @zzend_title = nil
  @coding_session_time = 0.0
  @com_session_time = 0.0
  @payed_time = 0.0
  @zzbegin_line_number = 0
  @zzend_line_number = 0
end

Instance Attribute Details

#coding_session_timeObject

Returns the value of attribute coding_session_time.



658
659
660
# File 'lib/devlog.rb', line 658

def coding_session_time
  @coding_session_time
end

#com_session_timeObject

Returns the value of attribute com_session_time.



658
659
660
# File 'lib/devlog.rb', line 658

def com_session_time
  @com_session_time
end

#payed_timeObject

Returns the value of attribute payed_time.



658
659
660
# File 'lib/devlog.rb', line 658

def payed_time
  @payed_time
end

#zzbeginObject

Returns the value of attribute zzbegin.



657
658
659
# File 'lib/devlog.rb', line 657

def zzbegin
  @zzbegin
end

#zzbegin_line_numberObject

Returns the value of attribute zzbegin_line_number.



659
660
661
# File 'lib/devlog.rb', line 659

def zzbegin_line_number
  @zzbegin_line_number
end

#zzbegin_titleObject

Returns the value of attribute zzbegin_title.



657
658
659
# File 'lib/devlog.rb', line 657

def zzbegin_title
  @zzbegin_title
end

#zzendObject

Returns the value of attribute zzend.



657
658
659
# File 'lib/devlog.rb', line 657

def zzend
  @zzend
end

#zzend_line_numberObject

Returns the value of attribute zzend_line_number.



659
660
661
# File 'lib/devlog.rb', line 659

def zzend_line_number
  @zzend_line_number
end

#zzend_titleObject

Returns the value of attribute zzend_title.



657
658
659
# File 'lib/devlog.rb', line 657

def zzend_title
  @zzend_title
end

#zztypeObject

Returns the value of attribute zztype.



657
658
659
# File 'lib/devlog.rb', line 657

def zztype
  @zztype
end

Instance Method Details

#<=>(other) ⇒ Object



675
676
677
# File 'lib/devlog.rb', line 675

def <=>(other)
  zzbegin <=> other.zzbegin
end

#daysObject

zezzion_time in days



685
686
687
688
689
690
# File 'lib/devlog.rb', line 685

def days
  min = self.time / 60
  hours = min / 60
  days = hours / 24
  days
end

#per_dayObject

hours per day



698
699
700
701
# File 'lib/devlog.rb', line 698

def per_day
  # whole time over number of days the parsing covers
  session_time/days
end

#per_monthObject

todo



705
706
707
# File 'lib/devlog.rb', line 705

def per_month
  # todo
end

#per_weekObject



702
703
704
# File 'lib/devlog.rb', line 702

def per_week
  # todo
end

#session_timeObject

the whole coding session time



693
694
695
# File 'lib/devlog.rb', line 693

def session_time
  @coding_session_time + @com_session_time #in seconds
end

#timeObject

in seconds



680
681
682
# File 'lib/devlog.rb', line 680

def time
  @zzend.to_time -  @zzbegin.to_time
end

#to_sObject



713
714
715
# File 'lib/devlog.rb', line 713

def to_s
  "#{session_time.round(3)} [h] #{type}, begin on line #{@zzbegin_line_number} at #{@zzbegin}, ends on line #{@zzend_line_number} at #{@zzend}"
end

#typeObject



709
710
711
# File 'lib/devlog.rb', line 709

def type
  zztype == 0 ? "CodingSession" : "ComSession"
end