Class: Railslog::Release

Inherits:
Object
  • Object
show all
Defined in:
lib/railslog.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(release_title) ⇒ Release

Returns a new instance of Release.



55
56
57
58
59
# File 'lib/railslog.rb', line 55

def initialize(release_title)
  @title = Helper.normalize(release_title)
  @version = @title[/\d+\.\d+(?:\.\d+)?/]
  @date = Date.parse(@title[/\(([^\)]+)\)/, 1]) rescue nil
end

Instance Attribute Details

#dateObject (readonly)

Returns the value of attribute date.



49
50
51
# File 'lib/railslog.rb', line 49

def date
  @date
end

#entriesObject (readonly)

Returns the value of attribute entries.



49
50
51
# File 'lib/railslog.rb', line 49

def entries
  @entries
end

#titleObject (readonly)

Returns the value of attribute title.



49
50
51
# File 'lib/railslog.rb', line 49

def title
  @title
end

#versionObject (readonly)

Returns the value of attribute version.



49
50
51
# File 'lib/railslog.rb', line 49

def version
  @version
end

Class Method Details

.recognize?(line) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/railslog.rb', line 51

def self.recognize?(line)
  line =~ /^\*\S/
end

Instance Method Details

#add_entry(entry) ⇒ Object



61
62
63
64
# File 'lib/railslog.rb', line 61

def add_entry(entry)
  @entries ||= []
  @entries << entry
end

#to_sObject



66
67
68
# File 'lib/railslog.rb', line 66

def to_s
  "<#{self.class} version:#{@version} date:#{@date}>"
end