Class: VCLog::ChangePoint
- Inherits:
-
Object
- Object
- VCLog::ChangePoint
- Defined in:
- lib/vclog/change_point.rb
Overview
The Change class models an entry in a change log.
Instance Attribute Summary collapse
-
#change ⇒ Object
readonly
Change from which point is derived.
-
#color ⇒ Object
ANSI color to apply.
-
#label ⇒ Object
The descriptive label of this change, as assigned by hueristics.
-
#level ⇒ Object
The priority level of this change, as assigned by hueristics.
-
#message ⇒ Object
(also: #msg)
The point’s message.
-
#type ⇒ Object
Type of change, as assigned by hueristics.
Instance Method Summary collapse
-
#apply_heuristics(heuristics) ⇒ Object
Apply heuristic rules to change.
-
#initialize(change, message) ⇒ ChangePoint
constructor
A new instance of ChangePoint.
-
#method_missing(s, *a, &b) ⇒ Object
Delegate missing methods to
change
. -
#points ⇒ Object
Change points do not have sub-points.
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(change, message) ⇒ ChangePoint
Returns a new instance of ChangePoint.
24 25 26 27 28 29 30 |
# File 'lib/vclog/change_point.rb', line 24 def initialize(change, ) @change = change @message = .strip @label = nil @level = nil end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(s, *a, &b) ⇒ Object
Delegate missing methods to change
.
41 42 43 44 45 46 47 48 |
# File 'lib/vclog/change_point.rb', line 41 def method_missing(s,*a,&b) if @change.respond_to?(s) @change.send(s,*a,&b) else p caller super(s,*a,&b) end end |
Instance Attribute Details
#change ⇒ Object (readonly)
Change from which point is derived.
33 34 35 |
# File 'lib/vclog/change_point.rb', line 33 def change @change end |
#color ⇒ Object
ANSI color to apply. Actually this can be a list of any support ansi gem terms, but usually it’s just the color term, such as ‘:red`.
21 22 23 |
# File 'lib/vclog/change_point.rb', line 21 def color @color end |
#label ⇒ Object
The descriptive label of this change, as assigned by hueristics.
16 17 18 |
# File 'lib/vclog/change_point.rb', line 16 def label @label end |
#level ⇒ Object
The priority level of this change, as assigned by hueristics. This can be ‘nil`, as Heuristics will always make sure a commit has an inteer level before going out to template.
13 14 15 |
# File 'lib/vclog/change_point.rb', line 13 def level @level end |
#message ⇒ Object Also known as: msg
The point’s message.
36 37 38 |
# File 'lib/vclog/change_point.rb', line 36 def @message end |
#type ⇒ Object
Type of change, as assigned by hueristics.
8 9 10 |
# File 'lib/vclog/change_point.rb', line 8 def type @type end |
Instance Method Details
#apply_heuristics(heuristics) ⇒ Object
Apply heuristic rules to change.
56 57 58 |
# File 'lib/vclog/change_point.rb', line 56 def apply_heuristics(heuristics) heuristics.apply(self) end |
#points ⇒ Object
Change points do not have sub-points.
51 52 53 |
# File 'lib/vclog/change_point.rb', line 51 def points [] end |
#to_h ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'lib/vclog/change_point.rb', line 61 def to_h { 'author' => change., 'date' => change.date, 'id' => change.id, 'message' => , 'type' => type } end |
#to_s ⇒ Object
71 72 73 |
# File 'lib/vclog/change_point.rb', line 71 def to_s(*) end |