Class: Machinery::SystemFile

Inherits:
Object show all
Defined in:
lib/system_file.rb

Instance Attribute Summary

Attributes inherited from Object

#attributes, #scope

Instance Method Summary collapse

Methods inherited from Object

#==, #[], #[]=, #as_json, #compare_with, convert_element, convert_raw_hash, #empty?, from_json, has_property, #hash, #initialize, #initialize_copy, #method_missing, #respond_to?, #set_attributes

Constructor Details

This class inherits a constructor from Machinery::Object

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Machinery::Object

Instance Method Details

#binary?Boolean

Returns:

  • (Boolean)


50
51
52
53
# File 'lib/system_file.rb', line 50

def binary?
  assert_scope
  scope.binary?(self)
end

#contentObject



55
56
57
58
# File 'lib/system_file.rb', line 55

def content
  assert_scope
  scope.file_content(self)
end

#deleted?Boolean

Returns:

  • (Boolean)


36
37
38
39
40
41
42
# File 'lib/system_file.rb', line 36

def deleted?
  if changes && changes.include?("deleted")
    true
  else
    false
  end
end

#directory?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/system_file.rb', line 28

def directory?
  type == "dir"
end

#file?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/system_file.rb', line 20

def file?
  type == "file"
end

#link?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/system_file.rb', line 24

def link?
  type == "link"
end

#on_disk?Boolean

Returns:

  • (Boolean)


44
45
46
47
48
# File 'lib/system_file.rb', line 44

def on_disk?
  assert_scope

  scope.extracted && file? && !deleted?
end

#remote_directory?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/system_file.rb', line 32

def remote_directory?
  type == "remote_dir"
end