Class: AppInfo::File

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, logger: AppInfo.logger) ⇒ File

Returns a new instance of File.



8
9
10
11
# File 'lib/app_info/file.rb', line 8

def initialize(file, logger: AppInfo.logger)
  @file = file
  @logger = logger
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



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

def file
  @file
end

#loggerObject (readonly)

Returns the value of attribute logger.



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

def logger
  @logger
end

Instance Method Details

#deviceObject

This method is abstract.

Subclass and override #device to implement.



36
37
38
# File 'lib/app_info/file.rb', line 36

def device
  not_implemented_error!(__method__)
end

#formatSymbol

Returns AppInfo::Format.

Returns:



14
15
16
17
18
19
20
21
22
23
# File 'lib/app_info/file.rb', line 14

def format
  @format ||= lambda {
    if instance_of?(AppInfo::File) || instance_of?(AppInfo::Apple) ||
       instance_of?(AppInfo::Android)
      not_implemented_error!(__method__)
    end

    self.class.name.split('::')[-1].downcase.to_sym
  }.call
end

#manufacturerObject

This method is abstract.

Subclass and override #manufacturer to implement.



31
32
33
# File 'lib/app_info/file.rb', line 31

def manufacturer
  not_implemented_error!(__method__)
end

#not_implemented_error!(method) ⇒ Object

Raises:

  • (NotImplementedError)


45
46
47
# File 'lib/app_info/file.rb', line 45

def not_implemented_error!(method)
  raise NotImplementedError, ".#{method} method implantation required in #{self.class}"
end

#platformObject

This method is abstract.

Subclass and override #platform to implement.



26
27
28
# File 'lib/app_info/file.rb', line 26

def platform
  not_implemented_error!(__method__)
end

#size(human_size: false) ⇒ Object

This method is abstract.

Subclass and override #size to implement



41
42
43
# File 'lib/app_info/file.rb', line 41

def size(human_size: false)
  not_implemented_error!(__method__)
end