Class: Modification
- Inherits:
-
Object
- Object
- Modification
- Includes:
- Comparable
- Defined in:
- lib/header-inserter/modification.rb
Constant Summary collapse
- @@revision_format =
/r(\d{1,}) \| (\S+) \| (\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) ([+|-]?\d{2})(\d{2}) .* \| \d{1,} line[s]?\n\n(.*)\n/m
- @@svn_time_format =
"%Y-%m-%d %H:%M:%S %z"
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#log ⇒ Object
readonly
Returns the value of attribute log.
-
#revision ⇒ Object
readonly
Returns the value of attribute revision.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(revision, author, date, log) ⇒ Modification
constructor
A new instance of Modification.
Constructor Details
#initialize(revision, author, date, log) ⇒ Modification
Returns a new instance of Modification.
21 22 23 24 25 26 |
# File 'lib/header-inserter/modification.rb', line 21 def initialize revision, , date, log @revision = revision @author = @date = date @log = log end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
8 9 10 |
# File 'lib/header-inserter/modification.rb', line 8 def @author end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
8 9 10 |
# File 'lib/header-inserter/modification.rb', line 8 def date @date end |
#log ⇒ Object (readonly)
Returns the value of attribute log.
8 9 10 |
# File 'lib/header-inserter/modification.rb', line 8 def log @log end |
#revision ⇒ Object (readonly)
Returns the value of attribute revision.
8 9 10 |
# File 'lib/header-inserter/modification.rb', line 8 def revision @revision end |
Class Method Details
.parse(text_log) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/header-inserter/modification.rb', line 10 def Modification.parse text_log if @@revision_format.match text_log revision = $1.to_i = $2 time_zone = ($4 + ":" + $5) date = DateTime.strptime($3 + " " + time_zone, @@svn_time_format) log = $6 Modification.new revision, , date, log end end |
Instance Method Details
#<=>(other) ⇒ Object
28 29 30 |
# File 'lib/header-inserter/modification.rb', line 28 def <=> other revision <=> other.revision end |