Class: Oode::File
- Inherits:
-
Object
- Object
- Oode::File
- Defined in:
- lib/oode/domain/file.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #basename ⇒ Object
- #extension ⇒ Object
-
#initialize(path, user) ⇒ File
constructor
A new instance of File.
- #remote_path ⇒ Object
- #size ⇒ Object
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
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/oode/domain/file.rb', line 3 def path @path end |
#user ⇒ Object (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
#basename ⇒ Object
19 20 21 |
# File 'lib/oode/domain/file.rb', line 19 def basename ::File.basename(path) end |
#extension ⇒ Object
15 16 17 |
# File 'lib/oode/domain/file.rb', line 15 def extension ::File.extname(path).split(".")[1].to_s end |
#remote_path ⇒ Object
11 12 13 |
# File 'lib/oode/domain/file.rb', line 11 def remote_path ::File.(::File.join(@user.home, ".oode", basename)) end |
#size ⇒ Object
23 24 25 |
# File 'lib/oode/domain/file.rb', line 23 def size ::File.size(::File.(path)) end |