Class: Dutiful::File

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ File

Returns a new instance of File.



5
6
7
8
# File 'lib/dutiful/file.rb', line 5

def initialize(path)
  @path      = path
  @full_path = ::File.expand_path "~/#{path}"
end

Instance Attribute Details

#full_pathObject (readonly)

Returns the value of attribute full_path.



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

def full_path
  @full_path
end

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

Instance Method Details

#exist?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/dutiful/file.rb', line 10

def exist?
  ::File.exist? @full_path
end

#synced?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/dutiful/file.rb', line 14

def synced?
  Dutiful::Config.storage.exist?(self) && Dutiful::Config.storage.synced?(self)
end