Class: ChupaText::ConfigurationLoader
- Inherits:
-
Object
- Object
- ChupaText::ConfigurationLoader
- Defined in:
- lib/chupa-text/configuration-loader.rb
Defined Under Namespace
Classes: DecomposerLoader, MIMETypesLoader
Instance Attribute Summary collapse
-
#decomposer ⇒ Object
readonly
Returns the value of attribute decomposer.
-
#mime_types ⇒ Object
readonly
Returns the value of attribute mime_types.
Instance Method Summary collapse
-
#initialize(configuration) ⇒ ConfigurationLoader
constructor
A new instance of ConfigurationLoader.
-
#load(path) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ ConfigurationLoader
Returns a new instance of ConfigurationLoader.
23 24 25 26 27 28 29 30 |
# File 'lib/chupa-text/configuration-loader.rb', line 23 def initialize(configuration) @configuration = configuration @decomposer = DecomposerLoader.new(@configuration.decomposer) @mime_types = MIMETypesLoader.new(@configuration.mime_type_registry) @load_paths = [] data_dir = Pathname(__dir__) + ".." + ".." + "data" @load_paths << data_dir. end |
Instance Attribute Details
#decomposer ⇒ Object (readonly)
Returns the value of attribute decomposer.
21 22 23 |
# File 'lib/chupa-text/configuration-loader.rb', line 21 def decomposer @decomposer end |
#mime_types ⇒ Object (readonly)
Returns the value of attribute mime_types.
22 23 24 |
# File 'lib/chupa-text/configuration-loader.rb', line 22 def mime_types @mime_types end |
Instance Method Details
#load(path) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/chupa-text/configuration-loader.rb', line 32 def load(path) path = resolve_path(path) File.open(path) do |file| instance_eval(file.read, path.to_path, 1) end end |