Class: Changelog::Item

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

Instance Method Summary collapse

Constructor Details

#initialize(title, id, description, sha, date, source, type = nil, status = nil, author = nil, environments = nil) ⇒ Item

Returns a new instance of Item.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/changelog.rb', line 103

def initialize(title, id, description, sha, date, source, type=nil, status=nil, author=nil, environments=nil)
  type ||="NA"
  status ||="UNKNOWN"
  author ||="UNKNOWN"
  environments ||= []
  @title = title.delete("\n")
  @description = description
  @sha = sha
  @date = date
  @id = id
  @source = source
  @type = type
  @status = status
  @author = author
  @environments = environments
end

Instance Method Details

#authorObject



136
137
138
# File 'lib/changelog.rb', line 136

def author
  return @author
end

#built?Boolean

Returns:

  • (Boolean)


168
169
170
# File 'lib/changelog.rb', line 168

def built?
  return self.environments.join.scan(/#(\d+)/).any? unless self.environments.nil?
end

#complete?Boolean

Returns:

  • (Boolean)


164
165
166
# File 'lib/changelog.rb', line 164

def complete?
  return %w(COMPLETED ACCEPTED).include?(self.status)
end

#dateObject



128
129
130
# File 'lib/changelog.rb', line 128

def date
  return @date
end

#environmentsObject



140
141
142
# File 'lib/changelog.rb', line 140

def environments
  return @environments.any? ? @environments : nil
end

#idObject



148
149
150
# File 'lib/changelog.rb', line 148

def id
  return @id
end

#inspectObject



120
121
122
# File 'lib/changelog.rb', line 120

def inspect
  "<#{@source} #{@type.upcase} ##{@id} : #{self.status} : #{@title}>"
end

#released?Boolean

Returns:

  • (Boolean)


172
173
174
# File 'lib/changelog.rb', line 172

def released?
  return self.environments.join.scan(/v(\d+)/).any? unless self.environments.nil?
end

#shaObject



144
145
146
# File 'lib/changelog.rb', line 144

def sha
  return @sha
end

#sourceObject



156
157
158
# File 'lib/changelog.rb', line 156

def source
  return @source
end

#sprintly?Boolean

Returns:

  • (Boolean)


160
161
162
# File 'lib/changelog.rb', line 160

def sprintly?
  return self.source.upcase == "SPRINT.LY"
end

#statusObject



152
153
154
# File 'lib/changelog.rb', line 152

def status
  return @status.nil? ? "NA" : @status.upcase
end

#titleObject



124
125
126
# File 'lib/changelog.rb', line 124

def title
  return @title
end

#typeObject



132
133
134
# File 'lib/changelog.rb', line 132

def type
  return @type
end