Class: FileHandlers::Base

Inherits:
Object
  • Object
show all
Extended by:
MemoWise
Defined in:
app/lib/file_handlers/base.rb

Class Method Summary collapse

Class Method Details

.can_load?(type) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
35
36
37
38
39
40
41
# File 'app/lib/file_handlers/base.rb', line 32

def can_load?(type)
  case type.class.name
  when "String"
    type.in? self::INPUT_TYPES.filter_map(&:to_s)
  when "Symbol"
    type.in? self::INPUT_TYPES.filter_map(&:to_sym)
  else
    type.in? self::INPUT_TYPES
  end
end

.can_save?(type) ⇒ Boolean

Returns:

  • (Boolean)


49
50
51
52
53
54
55
56
57
58
# File 'app/lib/file_handlers/base.rb', line 49

def can_save?(type)
  case type.class.name
  when "String"
    type.in? self::OUTPUT_TYPES.filter_map(&:to_s)
  when "Symbol"
    type.in? self::OUTPUT_TYPES.filter_map(&:to_sym)
  else
    type.in? self::OUTPUT_TYPES
  end
end

.icon ⇒ Object



23
24
25
# File 'app/lib/file_handlers/base.rb', line 23

def icon
  nil
end

.input_types ⇒ Object

For test mocking only



28
29
30
# File 'app/lib/file_handlers/base.rb', line 28

def input_types
  self::INPUT_TYPES
end

.open_url_for(target_url, client_os: nil) ⇒ Object

Raises:

  • (NotImplementedError)


61
62
63
# File 'app/lib/file_handlers/base.rb', line 61

def open_url_for(target_url, client_os: nil)
  raise NotImplementedError
end

.output_types ⇒ Object

For test mocking only



45
46
47
# File 'app/lib/file_handlers/base.rb', line 45

def output_types
  OUTPUT_TYPES
end

.priority ⇒ Object



19
20
21
# File 'app/lib/file_handlers/base.rb', line 19

def priority
  0
end