Class: Redmine::Scm::Adapters::Entries

Inherits:
Array
  • Object
show all
Defined in:
lib/redmine/scm/adapters/abstract_adapter.rb

Instance Method Summary collapse

Methods included from Diffable

#diff, #patch, #replacenextlarger, #reverse_hash

Instance Method Details

#compactObject

Required since Ruby 1.9.3 as the core compact always returns an instance of Array. This method follows the spec for Array#compact



257
258
259
260
261
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 257

def compact
  ary = self.dup
  ary.compact!
  ary
end

#revisionsObject



251
252
253
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 251

def revisions
  revisions ||= Revisions.new(collect{|entry| entry.lastrev}.compact)
end

#sort_by_nameObject



241
242
243
244
245
246
247
248
249
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 241

def sort_by_name
  sort {|x,y|
    if x.kind == y.kind
      x.name.to_s <=> y.name.to_s
    else
      x.kind <=> y.kind
    end
  }
end