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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Entry

Returns a new instance of Entry.



269
270
271
272
273
274
275
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 269

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

#kindObject

Returns the value of attribute kind.



268
269
270
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 268

def kind
  @kind
end

#lastrevObject

Returns the value of attribute lastrev.



268
269
270
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 268

def lastrev
  @lastrev
end

#nameObject

Returns the value of attribute name.



268
269
270
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 268

def name
  @name
end

#pathObject

Returns the value of attribute path.



268
269
270
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 268

def path
  @path
end

#sizeObject

Returns the value of attribute size.



268
269
270
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 268

def size
  @size
end

Instance Method Details

#is_dir?Boolean

Returns:

  • (Boolean)


281
282
283
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 281

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

#is_file?Boolean

Returns:

  • (Boolean)


277
278
279
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 277

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

#is_text?Boolean

Returns:

  • (Boolean)


285
286
287
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 285

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