Class: Oode::File

Inherits:
Object
  • Object
show all
Defined in:
lib/oode/domain/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, user) ⇒ File

Returns a new instance of File.



6
7
8
9
# File 'lib/oode/domain/file.rb', line 6

def initialize(path, user)
  @path = path
  @user = user
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/oode/domain/file.rb', line 3

def path
  @path
end

#userObject (readonly)

Returns the value of attribute user.



4
5
6
# File 'lib/oode/domain/file.rb', line 4

def user
  @user
end

Instance Method Details

#basenameObject



19
20
21
# File 'lib/oode/domain/file.rb', line 19

def basename
  ::File.basename(path)
end

#extensionObject



15
16
17
# File 'lib/oode/domain/file.rb', line 15

def extension
  ::File.extname(path).split(".")[1].to_s
end

#remote_pathObject



11
12
13
# File 'lib/oode/domain/file.rb', line 11

def remote_path
  ::File.expand_path(::File.join(@user.home, ".oode", basename))
end

#sizeObject



23
24
25
# File 'lib/oode/domain/file.rb', line 23

def size
  ::File.size(::File.expand_path(path))
end