Class: Redmine::Scm::Adapters::Entry

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

Instance Attribute Summary

Instance Method Summary

Constructor Details

- (Entry) initialize(attributes = {})

A new instance of Entry



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

def initialize(attributes={})
  self.name = attributes[:name] if attributes[:name]
  self.path = attributes[:path] if attributes[:path]
  self.kind = attributes[:kind] if attributes[:kind]
  self.size = attributes[:size].to_i if attributes[:size]
  self.lastrev = attributes[:lastrev]
end

Instance Attribute Details

- (Object) kind

Returns the value of attribute kind



239
240
241
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 239

def kind
  @kind
end

- (Object) lastrev

Returns the value of attribute lastrev



239
240
241
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 239

def lastrev
  @lastrev
end

- (Object) name

Returns the value of attribute name



239
240
241
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 239

def name
  @name
end

- (Object) path

Returns the value of attribute path



239
240
241
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 239

def path
  @path
end

- (Object) size

Returns the value of attribute size



239
240
241
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 239

def size
  @size
end

Instance Method Details

- (Boolean) is_dir?

Returns:

  • (Boolean)


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

def is_dir?
  'dir' == self.kind
end

- (Boolean) is_file?

Returns:

  • (Boolean)


248
249
250
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 248

def is_file?
  'file' == self.kind
end

- (Boolean) is_text?

Returns:

  • (Boolean)


256
257
258
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 256

def is_text?
  Redmine::MimeType.is_type?('text', name)
end