Class: FileBrowser::Entry

Inherits:
Object
  • Object
show all
Defined in:
app/models/file_browser/entry.rb

Constant Summary collapse

FILE =
'file'
DIRECTORY =
'directory'
TYPES =
[DIRECTORY, FILE]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Entry

Returns a new instance of Entry.



9
10
11
12
13
14
# File 'app/models/file_browser/entry.rb', line 9

def initialize(path)
  @path = path
  @name = get_name
  @type = get_type
  @ext  = get_ext
end

Instance Attribute Details

#extObject (readonly)

Returns the value of attribute ext.



7
8
9
# File 'app/models/file_browser/entry.rb', line 7

def ext
  @ext
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'app/models/file_browser/entry.rb', line 7

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'app/models/file_browser/entry.rb', line 7

def path
  @path
end

#typeObject (readonly)

Returns the value of attribute type.



7
8
9
# File 'app/models/file_browser/entry.rb', line 7

def type
  @type
end

Instance Method Details

#as_json(opts = {}) ⇒ Object



22
23
24
# File 'app/models/file_browser/entry.rb', line 22

def as_json(opts={})
  {'name' => name, 'type' => type, 'path' => path, 'ext' => ext}
end