Class: RgGen::Core::InputBase::Loader
- Inherits:
-
Object
- Object
- RgGen::Core::InputBase::Loader
show all
- Defined in:
- lib/rggen/core/input_base/loader.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(extractors, ignore_values) ⇒ Loader
Returns a new instance of Loader.
12
13
14
15
|
# File 'lib/rggen/core/input_base/loader.rb', line 12
def initialize(, ignore_values)
@extractors =
@ignore_values = ignore_values
end
|
Class Method Details
.support_types(types = nil) ⇒ Object
7
8
9
10
|
# File 'lib/rggen/core/input_base/loader.rb', line 7
def self.support_types(types = nil)
types && (@support_types ||= []).concat(types.map(&:to_sym))
@support_types
end
|
Instance Method Details
#load_file(file, input_data, valid_value_lists) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/rggen/core/input_base/loader.rb', line 23
def load_file(file, input_data, valid_value_lists)
File.readable?(file) ||
(raise Core::LoadError.new('cannot load such file', file))
@input_data = input_data
@valid_value_lists = valid_value_lists
format(read_file(file), input_data, input_data.layer, file)
end
|
#support?(file) ⇒ Boolean
17
18
19
20
21
|
# File 'lib/rggen/core/input_base/loader.rb', line 17
def support?(file)
ext = File.ext(file).to_sym
types = self.class.support_types
types&.any? { |type| type.casecmp?(ext) } || false
end
|